Created
March 3, 2016 03:23
-
-
Save anonymous/922c97644f8ff6917474 to your computer and use it in GitHub Desktop.
This file contains hidden or 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; | |
my $ua = Mojo::UserAgent->new(max_redirects => 10); | |
my $delay = Mojo::IOLoop->delay(sub { | |
my ($delay, $mojo, $minion) = @_; # Figure this magic voodoo out... | |
say $mojo->req->url . " -> " . $mojo->res->code; | |
say $minion->req->url . " -> " . $minion->res->code; | |
}); | |
$ua->get('http://slashdot.org' => $delay->begin); | |
$ua->get('https://www.google.com' => $delay->begin); | |
$ua->get('http://www.cnn.com' => $delay->begin); | |
$delay->wait; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
so in this example,
$mojo
is the Mojo::Transaction object that results from the slashdot request,$minion
is similarly the tx from the google request and the cnn one gets missed entirely.