in reply to Re^3: Stumped with select->can_read (buffered)
in thread Stumped with select->can_read
I tried doing that, but it didn't seem to work. My guess is that because one particular $fh is very busy, the while loop never ends?
This *seems* to work at the moment:
while(@ready = $sel->can_read) { foreach my $fh(@ready) { my $line = ""; sysread( $fh, $line, 1024 ); } }
My concern now is whether 1024 is too small of a buffer that I could miss something (if that's possible), or missing a newline character because of the buffer size. Would it be horrible (performance wise) to read one byte at a time until I reach a newline character, thus forming a real $line?
Thanks again!
Pedro
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Stumped with select->can_read (buffered)
by tye (Sage) on Aug 03, 2012 at 21:24 UTC | |
|
Re^5: Stumped with select->can_read (buffered)
by zentara (Cardinal) on Aug 04, 2012 at 08:00 UTC | |
by tye (Sage) on Aug 04, 2012 at 16:48 UTC |