You answered my question perfectly (I confess I'm new to the IPC game; actually I started reading that part of the Llama today). Good links. :)
In regards to the original question...I found this code on wikipedia, and it seems to do what you want(?).
#!/usr/bin/perl $pid = fork(); #Declare fork if ($pid == 0) { #Jump into the Child process for ($j = 0; $j < 10; $j++) { print "child: $j\n"; sleep 1; } exit(0); #Exit the fork [child process] } elsif ($pid > 0) { for ($i = 0; $i < 10; $i++) { print "parent: $i\n"; sleep 1; } exit(0); #Exit parent }
So the thing here is to test the pid. In your code, you would say:
$pm->finish if ($pid == 0 && $content =~ m/string/); #...no match, do more work... $pm->finish;
Or am I totally missing the boat here (likely)? :)
In reply to Re^3: Stop fork in Parallel::ForkManager
by Urthas
in thread Stop fork in Parallel::ForkManager
by casimo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |