I have been trying to use this module to do a tail -f on a windows logfile. I had some perl code to do it that I posted before and below, but it was reading the whole file and thus using too much memory. I tried ppm to load File::Tail and it looks for File::HiRes, yet the PM goes in Time::HiRes. I have struggled for hours trying to get this PM loaded.
I am ready to pay someone to help me.
I just need an efficient way to that won't use alot of memory to 'tail -f' a large windows file. That is all.

perl somescript.pl thefile > outputfile

I have this
$firstrun = 1; while(1) { if ( -s $file ) { sleep 1; open(TF,$file) || next ; seek(TF,0,0); @lines=<TF>; my $curpos=tell(TF); close(TF); if ( $firstrun < 1 ){ foreach $lyne (@lines){ printf $lyne; } } sleep 1; $firstrun = 0; while(-s $file ) { open(TF,$file) || last ; seek(TF,$curpos,0); @lines=<TF>; $curpos = tell(TF); last if ((stat(_))[7] < $curpos); foreach $lyne (@lines){ printf $lyne; } close(TF); sleep 1; } } else { sleep 5; } }

but it is a memory hog. Plus, sometimes I am not allowed to install PMs like File::Tail.
I like this offered by another Monk, but I am not skilled enough (see above) to turn it into efficient code.
while (1) { stat the file if size of file changed since last time { open file seek to previous EOF print file contents until EOF save EOF position for next time close the file } sleep for x seconds }
Can anyone help with making the above not read through the whole file, possibly becoming more memory efficient ?
Thanks

In reply to File::Tail on win32 by perlAffen

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.