Skip to content

Instantly share code, notes, and snippets.

@kraih
Created April 25, 2014 21:07
Show Gist options
  • Save kraih/11303310 to your computer and use it in GitHub Desktop.
Save kraih/11303310 to your computer and use it in GitHub Desktop.
use Mojo::Base -strict;
use Devel::Cycle;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
$ua->get('mojolicio.us' => sub {
my ($ua, $tx) = @_;
say $tx->res->code;
$ua->get('mojolicio.us' => sub {
my ($ua, $tx) = @_;
say $tx->res->code;
Mojo::IOLoop->stop;
});
});
find_cycle $ua;
Mojo::IOLoop->start;
# $ perl cps.pl
# 200
# 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment