Just another Perl shrine | |
PerlMonks |
Unexpected action at a distance with use warnings FATAL=>'all';by demerphq (Chancellor) |
on Jan 20, 2006 at 11:47 UTC ( [id://524451]=perlmeditation: print w/replies, xml ) | Need Help?? |
I had an interesting glitch occur to me today. I had some code like
The problem was that both interesting() and process() would die for certain error cases. And instead of skipping all the cases on first error i wanted to see all the errors, so I changed to code to something like this:
I was a little surprised to discover that now all of my cases were failing. What took me a while to work out was that I had in the code. Nexting out of an eval is a warning, and by promoting the warnings to a fatal the resulting behaviour of the code was fundamenetally changed. So next time you decide to use warnings fatal do yourself a favour and do a code review of any evals that you are using. Heres an example of the issue.
--- $world=~s/war/peace/g
Back to
Meditations
|
|