<?xml version="1.0" encoding="windows-1252"?>
<node id="317597" title="Re: Re: A simple example OO script for total beginners" created="2003-12-29 20:29:52" updated="2005-01-27 23:33:10">
<type id="11">
note</type>
<author id="205152">
nothingmuch</author>
<data>
<field name="doctext">
&lt;i&gt;The module has to return something to indicate success&lt;/i&gt;
&lt;p&gt;
I'd like to clarify. This is indeed not necessary for the class to work, but for perl to assume the inclusion of a file went well. When you [perldoc://do], [perldoc://use] or [perldoc://require] a file containing perl code, the value it returns to the caller is used to indicate proper loading, execution, or whatever the role of that code was. It is customary to end any perl code, especially that which is not a script pe se in a simple
&lt;p&gt;
&lt;code&gt;1;&lt;/code&gt;
&lt;p&gt;
because this is not erroneous as using [perldoc://return] is when there's nothing to return to (like in a simple script file), but does return truth when truth is needed, because in Perl the last value evaluated in some scope which returns (file, subroutine), is the return value.
&lt;p&gt;
In short, it's not necessary for the &lt;em&gt;class&lt;/em&gt; to work, but it &lt;em&gt;is&lt;/em&gt; necessary if the module which contains the class will be loaded via an external file inclusion, instead of being supplied in the same file.
&lt;div class="pmsig"&gt;&lt;div class="pmsig-205152"&gt;
-nuffin&lt;br&gt;zz zZ Z   Z #!perl
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
289076</field>
<field name="parent_node">
289248</field>
</data>
</node>
