Skip to content

Instantly share code, notes, and snippets.

@hirose31
Created March 11, 2014 10:33
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 hirose31/9483185 to your computer and use it in GitHub Desktop.
Save hirose31/9483185 to your computer and use it in GitHub Desktop.
use Sub::Retry;
my $ret = retry 3, 1, sub {
print "foo\n";
return 1;
}, sub {
my $ret = shift;
defined $ret ? 0: 1;
};
# =>
# foo
retry 3, 1, sub {
print "foo\n";
return 1;
}, sub {
my $ret = shift;
defined $ret ? 0: 1;
};
# =>
# foo
# foo
# foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment