mcogan1966 has asked for the wisdom of the Perl Monks concerning the following question:
for ($i=0; $i<$g; $i++) { pipe ($rh, $wh) # both of these are generated in the loop if ($pid[$i]=fork()) { # parent process waitpid($pid[$i], 0); # wait for child close ($wh); while (<$rh>) { # gimme the output if ($_ =~ m/^Error/) { push (@error, $_); } elsif ($_ =~ m^Hits/) { push (@hits, $_); } else { push (@data, $_); } # each is a result from an engine } } else { close ($rh); open (STDOUT, ">&$wh"); open (OUT, "| $caller"); # call the handler with arguments close (OUT); exit(0); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Concurrent Processes
by ptkdb (Monk) on Oct 21, 2003 at 18:11 UTC | |
by mcogan1966 (Monk) on Oct 21, 2003 at 18:32 UTC | |
by mpeppler (Vicar) on Oct 21, 2003 at 18:37 UTC | |
by mcogan1966 (Monk) on Oct 21, 2003 at 18:48 UTC | |
by ptkdb (Monk) on Oct 21, 2003 at 18:35 UTC | |
by ptkdb (Monk) on Oct 22, 2003 at 17:03 UTC | |
|
Re: Concurrent Processes
by QM (Parson) on Oct 21, 2003 at 23:18 UTC | |
|
Re: Concurrent Processes
by Skeeve (Parson) on Oct 22, 2003 at 08:15 UTC |