in reply to use sysread to read non-blocking filehandle
while ($bytes_read) { my $buf; $bytes_read = sysread($out, $buf, $blocksize); ...
Your code leaves the loop as soon as there is nothing to read on a socket.
while( <$fh> ) will read things until it encounters a newline.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: use sysread to read non-blocking filehandle
by x12345 (Novice) on Nov 04, 2014 at 13:06 UTC | |
by roboticus (Chancellor) on Nov 04, 2014 at 13:18 UTC | |
by x12345 (Novice) on Nov 04, 2014 at 13:36 UTC | |
by roboticus (Chancellor) on Nov 04, 2014 at 15:23 UTC | |
by Corion (Patriarch) on Nov 04, 2014 at 13:57 UTC | |
by ikegami (Patriarch) on Nov 04, 2014 at 17:00 UTC | |
by x12345 (Novice) on Nov 05, 2014 at 13:04 UTC |
In Section
Seekers of Perl Wisdom