## Wonderful catch-all ## Input : Nothing ## Output : Asked data sub AUTOLOAD { # Input variables my ($instance_ref) = shift(@_) ; # Internal vars $tries = 0 ; # Determine initially called sub my $command = $AUTOLOAD ; # Format it to call corresponding method on Redis package $command =~ s/.*:// ; $command = 'SUPER::' . $command ; TRY:while($tries < $maxtries) { # Go on $errorcode = eval {@results = $instance_ref->$command(@_)} ; # Did it went well ? if(!defined($errorcode)) { # No - I should log something here # Update count $tries++ ; # Wait a little bit ? sleep(1) ; # Go back to work next TRY; } # Otherwise that's cool last TRY; } # Return data return (@results) ; }