http://www.perlmonks.org?node_id=595484


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.