Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^7: How to tell a child what to do?

by Eyck (Priest)
on Sep 23, 2005 at 07:07 UTC ( #494420=note: print w/replies, xml ) Need Help??


in reply to Re^6: How to tell a child what to do?
in thread How to tell a child what to do?

I think, that if you rewrite this with sysread/syswrite, or, like in merlyn's solution with length-based communication, it starts working.

This may have something to do with perl's buffering, in particular, when instead of while (<>) I wrote this:

my $q; $q=<STDIN>; print "Received(child $$): $q\n";
it stopped hanging on close($fd).

When I traced what is happening when it hangs, it looks like parent is waiting waitpid(..) (close($fd) on pipe is supposed to do that), while child blissfully unaware is running read...

Now I can safely go and try to understand merlyn's code.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://494420]
help
Chatterbox?
[1nickt]: my $x = $aohoaoh->[0]->{' foo'}->[0]->{'bar' }; should work
[thepkd]: its not $aohoaoh->[0]. its $aohoaoh[0]->{'foo '}. Tried it. Its working. Thnaks
[thepkd]: Hey 1nickt sorry man. What
[GotToBTru]: a ref too far ;)
[thepkd]: Yes this is my first time in cb. Trying to work my way around.
[JohnCub]: "A ref too far" would make a good title for anyone's perl memoirs
[thepkd]: Anyways it works with $aohoaoh[0]->{'foo '}[0]->{'bar'}

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2016-12-06 13:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (105 votes). Check out past polls.