in reply to Re^3: Different perl behavior between V5.10 and V5.14
in thread Different perl behavior between V5.10 and V5.14
#!/usr/bin/perl -w use Time::HiRes; $SIG{"ALRM"}=\&sigAlarm; my $interval=1; my $uInterval=$interval*10**6; Time::HiRes::ualarm($uInterval, $uInterval); my $logname='xyz'; open TAIL, "tail -f $logname|" or die "couldn't open $logname"; while (1) { while(1) { if (eof(TAIL)) { printf "EOF: %d\n", eof(TAIL); $line=<TAIL>; next; } last if !($line=<TAIL>); print $line; } print "Fell through...\n"; } sub sigAlarm { print "alarm\n"; }
I also wonder if doing that eof() test at the beginning go throw me into an infinite loop under some conditions, but as so far this seems to be ok for now.
-mark
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Different perl behavior between V5.10 and V5.14
by markseger (Beadle) on Apr 01, 2013 at 17:24 UTC | |
by vsespb (Chaplain) on Apr 01, 2013 at 18:03 UTC |