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