Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://595484]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.