2014/10/24

Try::Tiny::Retry

#!/usr/bin/env perl

use Try::Tiny::Retry;

my $current = 1;
sub get_next {
    return $current++;
}

retry {
    print get_next() . "\n" and die;
}
catch {
    print "catched\n";
}
finally {
    print "finally\n";
}

No comments:

Post a Comment