|
|
| We don't bite newbies here... much | |
| PerlMonks |
Re^2: Best Practices for Exception Handlingby adrianh (Chancellor) |
| on Jan 29, 2003 at 11:47 UTC ( #230921=note: print w/ replies, xml ) | Need Help?? |
|
I'd add another vote for Exception::Class. It allows exceptions classes to be declared quickly and easily and has become my fave since discovering its existance. I tend to have a single module that declares all my exceptions. So for my Foo application I'd have something like:
Comments are because Exception::Class objects have a default "error" field and I like to document what that should be used for where I declare the class. Throw exceptions like this:
Because of the closure issues raised by thraxil, I use the eval / if idiom instead of any of the modules that provide extra try/catch syntax.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||