Subject: | bugs in the way delays and retries are handled |
Attempt-1.01
code review
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.
if you wish to have a patch, i can throw one together.
also see my code review, which spawned this ticket.
~particle