3 # test added 29th April 1999 by Paul Johnson (pjcj@transeda.com)
4 # updated 28th May 1999 by Paul Johnson
14 $File =~ s/^t\W+//; # Remove first directory
17 require strict; import strict;
22 BEGIN { plan tests => 12 }
31 $l .= $f->input_line_number;
32 $l .= " $."; # check $. before and after input_line_number
38 open (F, $File) or die $!;
39 my $io = IO::File->new($File) or die $!;
42 ok(lineno($io), "10 0 10");
44 $io->getline for (1 .. 5);
45 ok(lineno($io), "5 5 5");
48 ok(lineno($io), "11 5 11");
51 ok(lineno($io), "6 6 6");
53 $t = tell F; # tell F; provokes a warning
54 ok(lineno($io), "11 6 11");
57 ok(lineno($io), "12 6 12");
60 ok(lineno($io), "12 6 12");
63 ok(lineno($io), "22 6 22");
65 $io->getline for (1 .. 5);
66 ok(lineno($io), "11 11 11");
69 # We used to have problems here before local $. worked.
70 # input_line_number() used to use select and tell. When we did the
71 # same, that mechanism broke. It should work now.
72 ok(lineno($io), "22 11 22");
76 $io->getline for (1 .. 5);
77 ok(lineno($io), "16 16 16");
80 ok(lineno($io), "22 16 22");