Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Non blocking read on a filehandle

by c-era (Curate)
on Jan 30, 2001 at 19:35 UTC ( [id://55250]=note: print w/replies, xml ) Need Help??


in reply to Non blocking read on a filehandle

If you are on Win32, you are just out of luck. But if you are on unix/linux you can set the filehandle to non-blocking. This will let you read from the handle if something is there. If nothing is there it will continue on to the next line of code.
use Fcntl; my $flags; fcntl(FILEHANDLE, F_GETFL, $flags) || die $!; # Get the current flags +on the filehandle $flags |= O_NONBLOCK; # Add non-blocking to the flags fcntl(FILEHANDLE, F_SETFL, $flags) || die $!; # Set the flags on the f +ilehandle

Replies are listed 'Best First'.
Re: Re: Non blocking read on a filehandle
by odie (Sexton) on Jan 30, 2001 at 19:55 UTC
    This seems to work. (so far =)
    It is also quite nifty. I like it.

    --
    I am a manual signature virus. Copy me please!
Re^2: Non blocking read on a filehandle
by Anonymous Monk on Jan 08, 2009 at 16:08 UTC
    my $flags = 0; works for me

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-25 05:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found