in reply to Use of "die" in OO modules
I like to use Exception::Class to throw exceptions. If the caller wants to ignore my gravely important problems, it will have to do that explicitly. It's nice to have a module that contains all the exceptions I'll want to throw. It looks like:
package My::Exceptions; use Exception::Class ( 'My::Bad' => { description => 'Way bad', }, 'My::OtherBad' => { description => 'Bad as well', isa => 'My::Bad', }, ); 1;
Then anywhere I need them, just use My::Exceptions and My::Bad->throw( error => 'Woe is me' ).
|
|---|