Created
February 2, 2016 07:36
-
-
Save anonymous/a98c1ae0af256b3ac60c 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::Base -strict; | |
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://slashdot.org' => $delay->begin); | |
$ua->get('https://google.com' => $delay->begin); | |
$delay->wait; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment