Today I felt the urge to write on own tail utiltity (I work on W2k with perl Active State perl 5.8).
So I looked up CPAN and found File::Tail (version .98).
Here is the code I wroteuse warnings; use strict; use File::Tail; my $param = shift; my $file = new File::Tail(name=>$param, maxinterval=>1, adjustafter=>1 +); while(defined(my $line=$file->read)) { print "$line"; }
Now to test this code I create a file called fox.txt and saved it without any data in it.
I ran the script with the command (perl tail.pl fox.txt). Now I added the line "quick brown fox jumps over the lazy dog" to the fox.txt file and saved it. Nothing happened my tail utiltity printed nothing.
Next, I added a new line called "1 2 3" to the fox.txt.
Now the tail utiltity printed my first line "quick brown fox jumps over lazy dog". but not the "1 2 3".
Then I added another line "4 5 6" to the file and saved it. Now the utility printed "1 2 3".
This is not the behavior which I expected. I expected that my utility will print the lines which I added in the most recently saved file. I read the readme file but it didn't say that it is not compatible with my windows platform. So what wrong? why is it not working properly?
Please help.In reply to File::Tail behaves funny by abhishes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |