in reply to Nested evals - are they evil?
You might be able to install Carp's confess method as your fatal error handler. Then you can eliminate the evals and checking code.
Alternatively, you can set up local handlers and eliminate evals, on a case-by-case basis:#!/usr/bin/perl # # Die with backtrace # use Carp; $SIG{__DIE__} = \&Carp::confess; callMethod(); sub callMethod { # blah blah someMethod(0); } Sub someMethod { 1/shift; }
sub callMethod { local $SIG{__DIE__} = sub {confess ("error calling someMethod: $_[0] +")}; someMethod(0); }
|
|---|