in reply to Is recursion consistent with "use warnings"
As suggested by other posters, either drop the prototype (which doesn't buy you anything in the way you're using it), or declare the sub before defining it.
Note however that you still may get a warning - if your eval keeps failing, you'll hit a trigger that warns you for possible infinite recursion. Your sub is easily coded without recursion:
Of course, one can easily make a loop using while (or until), or even a goto as well.sub check_ip { { my $ip = eval { # Indirect object calls are so last millenium Net::IP->new(`curl whatismyisp.org`)->ip; }; return $ip if defined $ip; sleep 300; redo; } }
|
|---|