"be consistent" | |
PerlMonks |
Re: interprocess communicationby moritz (Cardinal) |
on May 15, 2014 at 17:30 UTC ( [id://1086180]=note: print w/replies, xml ) | Need Help?? |
Using the always-recommended use strict; use warnings; reveals one problem with your code:
Another is that only the parent process should wait for the child process; if doesn't make any sense to wait for anything in the child. In addition, doing a loop with non-blocking waitpid is useless; a single call to a blocking waitpid makes more sense. Or if you have only one child process, wait is even simpler. Finally, afer the fork there are two writers; one in the child, one in the parent process. You need to close the one in the writer too:
In Section
Seekers of Perl Wisdom
|
|