Skip to content

Instantly share code, notes, and snippets.

@yko
Created January 19, 2010 10:47
Show Gist options
  • Save yko/280841 to your computer and use it in GitHub Desktop.
Save yko/280841 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use Mojo::Client;
my $client = Mojo::Client->new( max_redirects => 3 );
my @urls = qw(http://bash.org http://autocentre.ua);
sub cb {
my ( $self, $tx ) = @_;
my $res = $tx->res;
if (@urls) {
$self->get(shift @urls, \&cb);
}
warn "Got page " . $tx->req->url->to_string . "\n";
}
$client
->get( "http://google.com" => \&cb)
->get( "http://yandex.ru" => \&cb)
->get( "http://autoelement.ua" => \&cb)
->process;
print "The end!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment