Parallel::Pipes::App - friendly interface for Parallel::Pipes
use Parallel::Pipes::App; my @result = Parallel::Pipes::App->map( num => 3, work => sub { my $task = shift; $task * 2 }, tasks => [1, 2, 3, 4, 5], ); # @result is ( 2, 4, 6, 8, 10 )
Parallel::Pipes::App provides friendly interfaces for Parallel::Pipes.
Parallel::Pipes::App provides 2 class method:
my @result = Parallel::Pipes::App->map( num => $num, work => $work, tasks => \@task, );
Process @task by $work in $num pre-forked child processes, and get @result. This is almost the same as
@task
$work
$num
@result
my @result = map { $work->($_) } @task;
except that $work is executed in a child process, not in the current process.
Parallel::Pipes::App->run( num => $num, work => $work, tasks => \@task, before_work => $before_work, after_work => $after_work, );
run is a more generic form of map. In fact, we can write map by using run:
run
map
my @result; Parallel::Pipes::App->run( num => $num, work => $work, tasks => \@task, before_work => sub {}, after_work => sub { push @result, $_[0] }, );
Shoichi Kaji <skaji@cpan.org>
Copyright 2016 Shoichi Kaji <skaji@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Parallel::Pipes, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parallel::Pipes
CPAN shell
perl -MCPAN -e shell install Parallel::Pipes
For more information on module installation, please visit the detailed CPAN module installation guide.