Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I do speak to my kid, but it does not listen ;-(
Nothing arrives there.
The problem here is, that what should be send coems once and a while, while the kid should send, what it has got exactly every minute.
So I am forking a kid to sleep until full minute and then I want to read what has come and send it, but the can_read(0) returns always an empty array..
this is the fork and the parent-talk
The Kid executes thismy $pid = open(PIP, "|-");# open to write if ( !$pid ) { # I'm the child sendToClient( $SOCKET ); # give the Socket =ok exit; } else { # I'm parent talking to the kid print PIP "Are you there?\n"; my $n = 0; while (1) { # just to test.. print PIP "hmm, No. ",++$n,"\n"; # kid ?? print "hmm, No. $n\n"; sleep 1;#control -> ok! }
But @lines is allways empty - why && how to change?sub sendToClient { my $SOC = ( shift ); my $HDL = IO::Select->new( \*STDIN ); while ( $HDL->exists( \*STDIN ) ){ # ok! mySleepToFullMinute(); # ok, not the problem my @lines = $HDL->can_read( 0 ); # allways empty??? foreach my $l (@lines) { print $SOC $l; # nothing to send?? } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: forked kid can't read from IO::Select->can_read
by polettix (Vicar) on May 22, 2005 at 13:45 UTC | |
by Anonymous Monk on May 22, 2005 at 14:19 UTC | |
by Forsaken (Friar) on May 22, 2005 at 18:01 UTC | |
by sfink (Deacon) on May 22, 2005 at 20:35 UTC | |
by Anonymous Monk on May 23, 2005 at 14:47 UTC | |
by polettix (Vicar) on May 22, 2005 at 21:02 UTC | |
|
Re: forked kid can't read from IO::Select->can_read
by thcsoft (Monk) on May 22, 2005 at 12:10 UTC | |
by Errto (Vicar) on May 22, 2005 at 15:07 UTC | |
by Anonymous Monk on May 22, 2005 at 13:05 UTC |