Help for this page

Select Code to Download


  1. or download this
        sub retry {
            my $job     = shift;
    ...
            sleep $delay while !($res = &$job) && --$retries;
            return $res;
        }
    
  2. or download this
        use Test::More tests => 5;
    
    ...
            my $i = 0;
            sub { $i++ }
        }
    
  3. or download this
        1..5
        ok 1 - always-failing job fails 1 retry
    ...
        ok 3 - always-succeeding job succeeds regardless of retries
        ok 4 - succeed-on-second job fails if given only 1 retry
        ok 5 - succeed-on-second job succeeds if given 2 retries