Skip to content

Instantly share code, notes, and snippets.

@kimmel
Created May 15, 2013 13:46
Show Gist options
  • Save kimmel/5584103 to your computer and use it in GitHub Desktop.
Save kimmel/5584103 to your computer and use it in GitHub Desktop.
Parallel::ForkManager example
use v5.16;
use warnings;
use autodie qw( :all );
use utf8::all;
use Parallel::ForkManager;
my $process_count = 12;
sub run_list {
my $pm = shift;
my $log = shift;
my $entries = shift;
foreach my $b ( @{$entries} ) {
print {$log} " processing: $b\n";
my $pid = $pm->start and next;
#...
$pm->finish;
}
return;
}
...
my $pm = Parallel::ForkManager->new($process_count);
run_list($pm, $log, \@entires);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment