Skip to content

Instantly share code, notes, and snippets.

@tempire
Last active December 10, 2015 10:48
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 tempire/4422901 to your computer and use it in GitHub Desktop.
Save tempire/4422901 to your computer and use it in GitHub Desktop.
use Modern::Perl;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new(max_redirects => 10);
my $tx = $ua->build_tx(get => 'irclog.perlgeek.de/mojo/today');
$tx->on(finish => sub {
my ($ua, $tx) = @_;
# Redirect is not followed when ->req or ->res used
$tx->req;
});
$ua->start($tx);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment