Created
March 11, 2014 10:33
-
-
Save hirose31/9483185 to your computer and use it in GitHub Desktop.
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 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