The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Parallol - Because parallel requests should be as fun as parallololololol!

SYNOPSIS

my $p = Parallol->new;
my $ua = Mojo::UserAgent->new;

my $titles = {};

$p->on_done(sub {
  say $titles;
});

$ua->get('http://bbc.co.uk/', $p->do(sub {
  $titles->{bbc} = pop->res->dom->at('title')->text;
}));

$ua->get('http://mojolicio.us/', $p->do(sub {
  $titles->{mojo} = pop->res->dom->at('title')->text;
}));

DESCRIPTION

Basic action for tracking parallel requests and running callbacks after the last request completes. See Mojolicious::Plugin::Parallel for a more concrete implementation of this technique.

METHODS

do

Wrap a request in a callback, and track parallel count.

SEE ALSO

Mojolicious, Mojolicious::Plugin::Parallol

AUTHOR

Magnus Holm mailto:magnus@nordaaker.com

LICENSE

This software is licensed under the same terms as Perl itself.