Created
February 2, 2016 07:33
-
-
Save anonymous/93354c458898fc85d80d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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