Parallel::Pipes::App(3pm) User Contributed Perl Documentation Parallel::Pipes::App(3pm)

# [NAME](#NAME)

Parallel::Pipes::App - friendly interface for Parallel::Pipes

# [SYNOPSIS](#SYNOPSIS)

```
  use Parallel::Pipes::App;
  my @result = Parallel::Pipes::App->map(
    num => 3,
    work => sub ($task) { $task * 2 },
    tasks => [1, 2, 3, 4, 5],
  );
  # @result is ( 2, 4, 6, 8, 10 )
```

# [DESCRIPTION](#DESCRIPTION)

Parallel::Pipes::App provides friendly interfaces for Parallel::Pipes.

# [METHODS](#METHODS)

Parallel::Pipes::App provides 2 class method:

## [map](#map)

```
  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

```
  my @result = map { $work->($_) } @task;
```

except that $work is executed in a child process, not in the current process.

## [run](#run)

```
  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":

```
  my @result;
  Parallel::Pipes::App->run(
    num => $num,
    work => $work,
    tasks => \@task,
    before_work => sub (@) {},
    after_work => sub ($item) { push @result, $item },
  );
```

# [COPYRIGHT AND LICENSE](#COPYRIGHT_AND_LICENSE)

Copyright 2016 Shoichi Kaji &lt;skaji@cpan.org&gt;

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2026-06-18 perl v5.42.2

---

Document: Parallel::Pipes::App(3pm) from perl-parallel-pipes 1.0.0-r1 (Chainguard OS)
Source: https://github.com/skaji/Parallel-Pipes
