Parallel::Async::Chain - task chain manager.
Execute tasks on child processes and wait for receive return values.
# create new task my $task_add = async { my ($x, $y) = @_; return $x + $y; }; my $task_sub = async { my ($x, $y) = @_; return $x - $y; }; my $task_times = async { my ($x, $y) = @_; return $x * $y; }; my $chain = $task_add->join($task_sub)->join($task_times); my ($res_add, $res_sub, $res_times) = $chain->recv(10, 20); say $res_add->[0]; ## 30 say $res_sub->[0]; ## -10 say $res_times->[0]; ## 200
Execute tasks on child processes.
# create new task my $task_add = async { my ($x, $y) = @_; return $x + $y; }; my $task_sub = async { my ($x, $y) = @_; return $x - $y; }; my $task_times = async { my ($x, $y) = @_; return $x * $y; }; my $chain = $task_add->join($task_sub)->join($task_times); my @pids = $chain->run(10, 20);
Execute tasks on daemonized processes.
# create new task my $task_add = async { my ($x, $y) = @_; return $x + $y; }; my $task_sub = async { my ($x, $y) = @_; return $x - $y; }; my $task_times = async { my ($x, $y) = @_; return $x * $y; }; my $chain = $task_add->join($task_sub)->join($task_times); my @pids = $chain->daemonize(10, 20);
Join multiple tasks, like Parallel::Async::Task#join.
Reset the execution status of all tasks, like Parallel::Async::Task#reset.
Clone and reset the execution status of all tasks, like Parallel::Async::Task#clone.
karupanerura <karupa@cpan.org>
To install Parallel::Async, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parallel::Async
CPAN shell
perl -MCPAN -e shell install Parallel::Async
For more information on module installation, please visit the detailed CPAN module installation guide.