Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
and the second sits in a while loop writing data to the same file every second:use strict; use warnings; use File::Tail; my $name = 'C:\File\test.dat'; my $ref=tie *FH,"File::Tail",(name=>$name, ignore_nonexistant=>1, interval=>0, maxinterval=>0.1, tail=>-1, maxbuf=>16, adjustafter=>1); while (<FH>) { print "$_"; }
I've messed with the buffer size, tried flushing the buffer via ($|++) on the print side but the script running the tail never seems to update. I'm assuming this has something to do with the file being open on both sides.use strict; use warnings; open(WRITE, ">>C:\\File\\test.dat"); my $num = 1; while(1) { print "$num\n"; print WRITE "$num\n"; sleep 1; $num ++; } close WRITE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tail, whiles and buffers ?
by davido (Cardinal) on Oct 19, 2006 at 17:13 UTC | |
by Anonymous Monk on Oct 19, 2006 at 17:37 UTC | |
by davido (Cardinal) on Oct 19, 2006 at 17:43 UTC | |
by Anonymous Monk on Oct 19, 2006 at 17:47 UTC | |
by Anonymous Monk on Oct 19, 2006 at 17:55 UTC | |
by davido (Cardinal) on Oct 19, 2006 at 18:04 UTC | |
by blazar (Canon) on Oct 20, 2006 at 16:06 UTC | |
by Anonymous Monk on Oct 19, 2006 at 17:28 UTC | |
by davido (Cardinal) on Oct 19, 2006 at 17:44 UTC | |
by Anonymous Monk on Oct 19, 2006 at 17:22 UTC | |
by davido (Cardinal) on Oct 19, 2006 at 17:46 UTC |