Parallol - Because parallel requests should be as fun as parallololololol!
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; }));
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.
Wrap a request in a callback, and track parallel count.
Mojolicious, Mojolicious::Plugin::Parallol
Magnus Holm mailto:magnus@nordaaker.com
This software is licensed under the same terms as Perl itself.
To install Parallol, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parallol
CPAN shell
perl -MCPAN -e shell install Parallol
For more information on module installation, please visit the detailed CPAN module installation guide.