Parall...s::App(3pm)

πŸ“¦
version 0.201 Β· 5 versions
, in epel 10

πŸ’… Parallel::Pipes::App β€” your friendly lil wrapper

okay so this is the Parallel::Pipes::App(3pm) page from the User Contributed Perl Documentation section, and honestly? it's giving "I made parallel processing not scary" and I'm obsessed 🫢


✨ NAME ✨

Parallel::Pipes::App β€” a friendly interface for Parallel::Pipes πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

bestie, look how easy this is:

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 )

like… that's it. that's the whole vibe check. ✨


🌸 DESCRIPTION 🌸

Parallel::Pipes::App provides friendly interfaces for Parallel::Pipes. no gatekeeping, no cap, it just hands you the nice version πŸ’–


πŸ‘‘ METHODS πŸ‘‘

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

lowkey iconic that there's only two. fewer things to remember, more brain cells for you 🧚

πŸ’œ map

my @result = Parallel::Pipes::App->map(
  num => $num,
  work => $work,
  tasks => \@task,
);

So it processes @task by $work in $num pre-forked child processes, and you get @result back. This is almost the same as:

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

except β€” and this is the main character detail β€” $work gets executed in a child process, not in the current process. that's the whole point, that's the slay πŸ”₯

🌈 run

Parallel::Pipes::App->run(
  num => $num,
  work => $work,
  tasks => \@task,
  before_work => $before_work,
  after_work => $after_work,
);

run is the more generic form of map. like, the bigger sister method. 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 { push @result, $_[0] },
);

see what they did there?? map is literally just run wearing a cute outfit πŸ’… iykyk


πŸ“ AUTHOR πŸ“

Shoichi Kaji <skaji@cpan.org> β€” king behavior, ngl πŸ‘‘


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.

fr fr that's the standard Perl license deal, no surprises, no drama πŸ™ˆ

okay bye bestie, go parallelize something πŸ’–βœ¨ this page was perl v5.40.2, dated 2025-06-10 β€” mwah, take care of yourself and your file descriptors πŸ¦‹πŸŒˆ

πŸ“¦ where this page comes from