Hello Respected Monks

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 wrote
use 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.
regards,
Abhishek.

In reply to File::Tail behaves funny by abhishes

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.