Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Re: Idomatic Handling of Subroutine Errorby btrott (Parson) |
on Sep 18, 2001 at 22:50 UTC ( [id://113171]=note: print w/replies, xml ) | Need Help?? |
That's not right. eval BLOCK has no overhead (or rather negligible overhead). eval EXPR (string eval) *does* have overhead, because the string needs to be compiled at runtime, but that's the issue here. In general, actually, I would tend to agree with you, but for a different reason: there is no sense in wrapping *every* function call in its own eval. Instead wrap an entire self-contained block in an eval, like this: You will jump out of the block as soon as your code hits an exception, and you might as well keep your exception-handling in one place, rather than scattered all over the place. To the OP: check out Exception::Class and Error, among others.
In Section
Seekers of Perl Wisdom
|
|