Slash Boxes
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • well, you never say what you expect it to do nor what it seems to do. this is a classic case of saying it doesn't work without saying anything else. you should know better than that! :)

    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, 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.