in reply to fork-ing : my lack of understanding
First of all print `...`; is silly. Just use system.
foreach $row ( @{$ref} ) { my $pid = $pm->start(@$row->[0]) and next; system 'alert_main.pl', '-h', $row->[0], '-p', $passId; print "\n"; $pm->finish($row); }
Second, system ...; exit; is also silly. Just use exec.
foreach $row ( @{$ref} ) { my $pid = $pm->start(@$row->[0]) and next; exec 'alert_main.pl', '-h', $row->[0], '-p', $passId; $pm->finish($row); # In case exec fails. }
By using exec, you only fork once per row instead of twice. Unfortunately, that's probably not enough to get rid of your problem.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: fork-ing : my lack of understanding
by ethrbunny (Monk) on Jul 19, 2007 at 22:13 UTC |