Skip to content

Instantly share code, notes, and snippets.

Created May 21, 2016 14:40
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 anonymous/b8007346f2b7f342ae2ced3fdc59ab22 to your computer and use it in GitHub Desktop.
Save anonymous/b8007346f2b7f342ae2ced3fdc59ab22 to your computer and use it in GitHub Desktop.
use 5.20.0;
my $whileStep = 0;
Mojo::IOLoop->delay(
sub {
my ($d, $err, $rval) = @_;
if ($whileStep++) {
die {err => $err} if $err;
# goto next step
return $d->pass if !$rval;
# do something with $rval
# ..
}
unshift @{$d->remaining}, __SUB__;
$c->doWhileTrue($d->begin);
},
)->catch(..);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment