NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
$ebits string is always true (Score:1)
one issue i see is that you don't handle when a socket/pipe closes. without removing a closed handle from that data it looks like it may do an infinite loop of reading zero bytes.
but the bug i see is the if( $ebits ) line. since $ebits is a char string and not likely be '0' or '', it will be true all the time. you need to either check those bits like with $rbits or do some check for any bit set (there is a ffs bit scan function somewhere out there).
and you don't need the == 1 when you check $rbits as it will do the right boolean test for you.
as for event loop modules, event.pm is very stable, trivial to learn and i think it would be even less code (and much clearer IMO) than you have now. pretty much 3 calls (looped if you'd like) to make read-events. and it will not have the 'bug' you have since it has been very clean for years.
uri
Reply to This