<?xml version="1.0" encoding="windows-1252"?>
<node id="1003898" title="Re: OOP: How to construct multiple instances of a class at once" created="2012-11-14 17:35:38" updated="2012-11-14 17:35:38">
<type id="11">
note</type>
<author id="647953">
sundialsvc4</author>
<data>
<field name="doctext">
&lt;p&gt;
Moose, of course, has a &amp;ldquo;getter/setter subroutine&amp;rdquo; notion, which is very sugar-y. &amp;nbsp; But you can easily enough do this on your own. &amp;nbsp; I often define an internal-use-only subroutine, named something like &lt;tt&gt;_getBlah&lt;/tt&gt; (the &amp;ldquo;&lt;tt&gt;_&lt;/tt&gt;&amp;rdquo; being my nomenclature for &amp;ldquo;for internal use only&amp;rdquo;) which determines if this-or-that information needs to be fetched and if necessary fetches it ... then (in any case) returns &lt;tt&gt;$self&lt;/tt&gt;. &amp;nbsp; This allows it to be used as a &amp;ldquo;pass-thru method&amp;rdquo; in the getter/setter methods, &lt;i&gt;e.g.&lt;/i&gt; &lt;tt&gt;return $self&lt;u&gt;-&amp;gt;_getUserInfo-&amp;gt;&lt;/u&gt;{'user_name'};&lt;/tt&gt;. &amp;nbsp; (Where &amp;ldquo;$self&amp;rdquo; is my habitual name for the local variable that refers to &amp;ldquo;me.&amp;rdquo;)
&lt;/p&gt;</field>
<field name="root_node">
1003841</field>
<field name="parent_node">
1003841</field>
</data>
</node>
