Created
July 12, 2014 14:47
-
-
Save jberger/a7e7c412aad48586b805 to your computer and use it in GitHub Desktop.
Demonstrate the cycle fixes in Mojolicious4.95
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
use Mojo::Base -strict; | |
use Mojo::UserAgent; | |
use Mojo::IOLoop; | |
use Devel::Cycle; | |
my $ua = Mojo::UserAgent->new; | |
my $delay = Mojo::IOLoop->delay; | |
$delay->steps( | |
sub { | |
my $delay = shift; | |
$ua->get('mojolicio.us' => $delay->begin); | |
find_cycle $ua; | |
}, | |
sub { | |
my ($delay, $tx) = @_; | |
say $tx->res->code; | |
$ua->get('mojolicio.us' => $delay->begin); | |
}, | |
sub { | |
my ($delay, $tx) = @_; | |
say $tx->res->code; | |
} | |
); | |
$delay->wait; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment