Attempt reviews

RSS | Module Info

Attempt (1.01) ***

the documentation is consise, as is the code this module provides.

unfortunately, there are bugs in the way delays and retries are handled. this is a classic bug--checking for existance of a key in a hash, without checking whether the value is valid.

here's an example, from the attempt subroutine:

# sleep if we need to

select undef, undef, undef, $args{delay}

if exists $args{delay};

if the delay key exists in the args hash, the select statement is run. but if the value of $args{delay} is undefined, select hangs. whoops!

checking whether the value is defined, and can be properly evaluated by select in numeric context would fix this problem.

similarly, this code

# find out how many attempts we're going to take,

# defaulting to two.

my $tries = exists($args{tries}) ? $args{tries} : 2;

will set $tries to undef if the key exists but is undefined. the same checks mentioned above would fix this problem as well.

overall, this module provides a subroutine that offers great benefits without getting in the way. i look forward to more tests, and bug fixes which will make this bulletproof, production-ready code.

Attempt (1.01) *****

This module is /the/ most intuitive interface i've seen for this problem, and it comes with no loss too - errors are not hidden or anything. It does not conflict with anything else... It's basically a stubborn eval {} which redies after it's given up.

I have yet to use the subroutine attributes and modifiers, but the normal attempt block was very useful thus far.

Attempt (1.00) *****

The Attempt module adds Ruby's "retry" mechanism to Perl, and even manages to be slightly more convenient and flexible.

This module is especially convenient for DBI connections (which is also what the author uses in his examples), for those times when the connection briefly flakes out for various reasons.

An instant classic IMO.