in reply to open(TO, "|-") is a bad file name?

Re: not enough arguments for select; look at your select, not at the pipe :) Can you spot the difference here:
$ c:/perl/bin/perl -we'select((select(TO_CHILD), $| = 1))[0]);' Not enough arguments for select system call at -e line 1, near "))" syntax error at -e line 1, near ")[" Execution of -e aborted due to compilation errors. $ c:/perl/bin/perl -we'select((select(TO_CHILD), ($| = 1))[0]);' Name "main::TO_CHILD" used only once: possible typo at -e line 1.
For multiple forks, you should be able to just put a for my $childnum (1..3) { ... } around your FORK block and have conditional code to do different things based on $childnum in the child section.

Don't know anything about |- on windows (other than that it works with cygwin :), sorry.

Replies are listed 'Best First'.
Re: Re: open(TO, "|-") is a bad file name?
by SavannahLion (Pilgrim) on Feb 24, 2004 at 05:56 UTC
    Hmmm, that is so interesting. I've been banging my head on a typo from the Camel?
    After reading your post, I went back and compared
    select((select(TO_CHILD), $| = 1))[0]);
    between what I wrote and the book. That is exactly as it appears in the 3rd edition of the Camel under Bidirectional Communication on page 432.

    Thank you for the $childnum suggestion, but where am I supposed to get that value from? The $pid results in a negative number for me. Searching for $childnum reveals only two nodes. And a search on PerlDoc turns up nothing :(

    ----
    Thanks for your patience.
    Prove your knowledge @ HLPD

      $childnum has no special meaning; I was just suggesting that you loop through the fork code three times, doing different things in the "child" section for each iteration (but making sure the child execs or exits or something rather than continuing the loop.)