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.
select modifies its arguments (Score:2)
The first 3 arguments to
selectare value/return - on input you give a bitmask of the file descriptors you are interested in, on output only the bits corresponding "interesting" file descriptors are set. So it's likely that after the first call toselect, all the bits were zeroed, and so for subsequent calls the arguments you passed in say that you're not interested in any file descriptors, so you never call any of your action functions. The solution is somethingRe: (Score:1)
Re: (Score:2)
Ah OK. So I was right when I had this hunch on hitting "Submit" that I'd missed something. :-)
Reinventing the wheel (Score:2)
Isn't there a module for this? Your mistake is in writing your own buggy code instead of using somebody's better tested module. :P
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:1)
Re: (Score:1)
Speaking of wheels, this seems an ideal candidate for a POE [cpan.org] session and POE::Wheel::FollowTail.
Re: (Score:1)
shave off lines (Reinventing the wheel) (Score:1)
Re: (Score:1)
Wrong order (Score:1)
Obviously, you should be doing
another_thing()in response to$p2coming ready. I wish you wouldn't post such trivial problems.fileno argument? (Score:1)
Can it really be that simple? (Score:1)
open [perl.org] does not return the filehandle, so it would appear that $p1 and friends are not what you seem to expect based on the rest of the code.
Re: (Score:1)
$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 eit