One of Perl's nice features is that it can actually output a warning when you're recursing too deeply (for whatever Perl considers to be "too deeply"). This trick changes that warning into an exit condition. This is a very simple case, if you need to keep the normal __WARN__ handler behaviour, things get a little more complicated.eval { use warnings 'recursion'; local $SIG{__WARN__} = sub { die "Too deep" if $_[0] =~ m#^Deep re +cursion# }; # your code }; # check $@ if you want to here
Hope this helps.
Liz
In reply to Re: Stopping code in eval
by liz
in thread Stopping code in eval
by Outaspace
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |