in reply to canonical doc explaing need for "eval { ... } or do {...}" construct
Personally, i usually use something like this:
use English; ... my $evalok = 0; eval { SOME_RISKY_CODE $evalok = 1; }; if(!$evalok) { print "Something bad happened: ", $EVAL_ERROR, "\n"; work_around_the_problem_or_give_up(); }
This may be a good or bad solution. But at least for me, it makes it easier and faster to visually scan the code later in its life cycle and see how it's meant to flow and if there is error handling in place.
|
|---|