Skip to content

Instantly share code, notes, and snippets.

@earino
Created July 26, 2012 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save earino/3183895 to your computer and use it in GitHub Desktop.
Save earino/3183895 to your computer and use it in GitHub Desktop.
parallelized first stab
my $pm = Parallel::ForkManager->new($PROCESSES);
my @list_of_work = qw/ BLAH BLAH BLAH /;
my @list_of_endpoints = qw/ YADDA YADDA YADDA /;
for my $unit_of_work (@list_of_work) {
my $pid = $pm->start and next;
for my $endpoint (@list_of_endpoints) {
my $value_retrieved = retrieve_value_from_stuff($unit_of_work);
do_stuff_to($value_retrieved);
push_value_retrieved_to($endpoint);
}
$pm->finish; # Terminates the child process
}
$pm->wait_all_children;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment