in reply to Re^2: IO::Handle read error description?
in thread IO::Handle read error description?

No. The whole point of using select is to let us know when reading from the socket won't block and when writing to the socket won't block.

Unfortunately, it doesn't tell us how much we can write to it without blocking. We only know that we can write one byte without blocking. Maybe non-blocking sockets would help in the writing half. Ideally, there would be a system call that tells us how much we can write without writing. I don't know if there is one.

Replies are listed 'Best First'.
Re^4: IO::Handle read error description?
by vsespb (Chaplain) on Apr 28, 2010 at 18:56 UTC
    I was thinking sysread(... 4096 ... will block until read all 4096 bytes...
      It will return whatever bytes are available.
      $ perl -e'$|=1; print "a"; print "b"; sleep 1; print "c"' | \ perl -le'print "[$buf]" while sysread(STDIN, $buf="", 4096);' [ab] [c]