Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Use of "die" in OO modules

by kyle (Abbot)
on Jan 18, 2007 at 19:14 UTC ( #595320=note: print w/replies, xml ) Need Help??

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' ).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://595320]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2019-11-22 20:35 GMT
Find Nodes?
    Voting Booth?
    Strict and warnings: which comes first?

    Results (113 votes). Check out past polls.