Automatically retry any subroutine in Perl