The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Parallel::Async::Chain - task chain manager.

METHODS

my @results = $chain->recv(@args)

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
my @pids = $chain->run(@args)

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);
my @pids = $chain->daemonize(@args)

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);
$chain->join($task1, ...);

Join multiple tasks, like Parallel::Async::Task#join.

$task->reset;

Reset the execution status of all tasks, like Parallel::Async::Task#reset.

$task->clone;

Clone and reset the execution status of all tasks, like Parallel::Async::Task#clone.

AUTHOR

karupanerura <karupa@cpan.org>