Skip to content

Instantly share code, notes, and snippets.

Created February 2, 2016 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/93354c458898fc85d80d to your computer and use it in GitHub Desktop.
Save anonymous/93354c458898fc85d80d to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use Mojo::UserAgent;
use Mojo::IOLoop;
# Synchronize non-blocking requests
my $ua = Mojo::UserAgent->new;
my $delay = Mojo::IOLoop->delay(sub {
my ($delay, $mojo, $minion) = @_;
say $mojo->res->dom->at('title')->text;
say $minion->res->dom->at('title')->text;
});
$ua->get('http://metacpan.org/search?q=mojo' => $delay->begin);
$ua->get('http://metacpan.org/search?q=minion' => $delay->begin);
$delay->wait;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment