I'm gradually taking over responsibility of a codebase that uses nested evals quite a bit. Sort of like this:
eval { callMethod(); }; if ($@) { confess "CallMethod failed: $@"; }
with callMethod() having another one embedded, eg
sub callMethod { # blah blah eval { someMoreCode(); }; if ($@) { confess "someMoreCode failed: $@"; } }
The impression I get is that some error checking is missing and this is a rough and ready way of dealing with fatal errors. It works, but for some reason, it makes me feel uncomfortable.
My instinct is telling me to get rid of these evals (while fixing exception handling), but am I just making work for myself? Or should I be embracing this exception handling technique as a tool for faster development?
edit - added bold ;-)
edit 2 - yes, the confesses were originally dies (so that explains quite a bit right there :)
In reply to Nested evals - are they evil? by cLive ;-)
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |