Beefy Boxes and Bandwidth Generously Provided by pair Networks
Joe Perl Monk, Perl Meditation  Non blocking read on a
filehandle  by odie (Sexton) on Jan 30, 2001 at 19:23 UTC
( #55241=perlquestion: print w/ replies, xml ) Need Help?? odie
has asked for the wisdom of the Perl Monks concerning the
following question:  I am using a bidirectional pipe to another
process. Readline will block the program until a line is
recieved. How do I read in a non blocking way? Is there perhaps
a smart (and nifty. must be nifty.) way to check if there is
data waiting?  I am a manual signature virus. Copy me please!
Comment on Non blocking read on a filehandle Re: Non blocking
read on a filehandle by Gloom (Monk) on Jan 30, 2001 at
19:31 UTC     Try to use select with a small timeout value.
Maybe you can use also the perl implementation of ioctl that
allow you to do non-blocking i/o ( among many other things )
Update :      It's also possible to handle the "IO" signal by
linking some function to $SIG{IO} sighandler,