Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^5: Different perl behavior between V5.10 and V5.14

by markseger (Beadle)
on Apr 01, 2013 at 17:24 UTC ( #1026518=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Different perl behavior between V5.10 and V5.14
in thread Different perl behavior between V5.10 and V5.14

I think I finally have a clean solution. After much reading and asking around in the office someone helped me with this snippet, assuming TAIL is the file handle you're doing the tail -f on. The answer is to simply redo the failed operation which previous responses had suggested. So if anyone is interested this is what I've settled on and particularly like it because it's short and straightforward:

while (1) { while(1) { my $line = <TAIL>; if (!defined($line)) { redo if $! eq 'Interrupted system call'; last; } print $line; } printf "Fell through...\n"; }

-mark


Comment on Re^5: Different perl behavior between V5.10 and V5.14
Download Code
Re^6: Different perl behavior between V5.10 and V5.14
by vsespb (Hermit) on Apr 01, 2013 at 18:03 UTC
    Yep, looks like a good workaround. Also I belive you can use
    $!{EINTR}
    instead of
    $! eq 'Interrupted system call'
    (as per '%!' in perlvar)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026518]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2014-07-26 16:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (178 votes), past polls