3 # test added 29th April 1999 by Paul Johnson (pjcj@transeda.com)
4 # updated 28th May 1999 by Paul Johnson
10 unless(grep /blib/, @INC) {
12 $File =~ s/^t\W+//; # Remove first directory
15 require strict; import strict;
20 BEGIN { plan tests => 12 }
29 $l .= $f->input_line_number;
30 $l .= " $."; # check $. before and after input_line_number
36 open (F, $File) or die $!;
37 my $io = IO::File->new($File) or die $!;
40 ok(lineno($io), "10 0 10");
42 $io->getline for (1 .. 5);
43 ok(lineno($io), "5 5 5");
46 ok(lineno($io), "11 5 11");
49 ok(lineno($io), "6 6 6");
51 $t = tell F; # tell F; provokes a warning
52 ok(lineno($io), "11 6 11");
55 ok(lineno($io), "12 6 12");
58 ok(lineno($io), "12 6 12");
61 ok(lineno($io), "22 6 22");
63 $io->getline for (1 .. 5);
64 ok(lineno($io), "11 11 11");
67 # We used to have problems here before local $. worked.
68 # input_line_number() used to use select and tell. When we did the
69 # same, that mechanism broke. It should work now.
70 ok(lineno($io), "22 11 22");
74 $io->getline for (1 .. 5);
75 ok(lineno($io), "16 16 16");
78 ok(lineno($io), "22 16 22");