in reply to nonblocking io

IO::Select's can_read method will (by default) block forever until something can be read. If passed an argument, it will only wait as many seconds (possibly fractional) as requested. If you call can_read with an argument of zero, it will return immediately, allowing you to do a non-blocking check to see if you have a readable socket.

For example:

use IO::Select; $s = IO::Select->new(); $s->add(\*STDIN); if ($s->can_read(0)) { # Non-blocking check. # Something to read! } else { # Nothing to read. }
Hope you find this useful.

Cheers,
Paul

Replies are listed 'Best First'.
Re: Re: nonblocking io
by smackdab (Pilgrim) on Oct 11, 2001 at 20:08 UTC
    Thanks!!!...got it working!!!