Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Use of "die" in OO modules

by sth (Priest)
on Jan 19, 2007 at 16:21 UTC ( #595484=note: print w/ replies, xml ) Need Help??


in reply to Re: Use of "die" in OO modules
in thread Use of "die" in OO modules

I recently added a ErrStr var to my modules, kinda of like the DBI::errstr. So if the object constructor fails the object is an undef and the the Errstr can be checked, i.e.

my $obj = Some::Module->new() or die $Some::Module::Errstr, $/;
...otherwise if there is an error with a method call the error string can be retrieved,
$obj->get_errstr();
I really struggled with what was the correct way to handle the errors, I'm still not sure I like my solution.


Comment on Re^2: Use of "die" in OO modules
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2014-12-23 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (135 votes), past polls