<?xml version="1.0" encoding="windows-1252"?>
<node id="595484" title="Re^2: Use of &quot;die&quot; in OO modules" created="2007-01-19 11:21:26" updated="2007-01-19 06:21:26">
<type id="11">
note</type>
<author id="125121">
sth</author>
<data>
<field name="doctext">
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.
&lt;CODE&gt;
       my $obj = Some::Module-&gt;new() or die $Some::Module::Errstr, $/;
&lt;/CODE&gt;

...otherwise if there is an error with a method call the error string can be retrieved,

&lt;CODE&gt;
      $obj-&gt;get_errstr();
&lt;/CODE&gt;

I really struggled with what was the correct way to handle the errors, I'm still not sure I like my solution.


</field>
<field name="root_node">
595313</field>
<field name="parent_node">
595438</field>
</data>
</node>
