in reply to Handling errors occuring inside complex modules
The poor man's hack is using eval to do the error handling.
eval { die "Goodbye cruel world" }; warn "eval died with $@" if $@;
eval{}; if($@) {} probably is the most common practice, but is ugly and error prone.
Other alternatives include error-handling modules such as TryCatch or Error (be aware that Error and Moose conflict if you use Moose.)
Try them (and other modules too!) and use which one feels more comfortable.
Update: I had completely missed you mentioned eval...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Handling errors occuring inside complex modules
by stvn (Monsignor) on Jan 19, 2010 at 02:01 UTC |