Skip to content

Instantly share code, notes, and snippets.

@jberger
Created July 12, 2014 14:47
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 jberger/a7e7c412aad48586b805 to your computer and use it in GitHub Desktop.
Save jberger/a7e7c412aad48586b805 to your computer and use it in GitHub Desktop.
Demonstrate the cycle fixes in Mojolicious4.95
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