note
gam3
It is important to note that Perl OO does not have any "built in" concept of data. There is no default <i>Constructor</i> and the <i>Destructor</i> consists of a call to <i>DESTROY</i>.
<p>
It might be more descriptive to rewrite <tt>Foo->new()->hello('test5');</tt>
as
<code>
bless(\sub {}, 'Foo')->hello('test5');
</code>
This just blesses a CODE_REF for fun. It could be a HASHREF or some other REF.
The only real difference between
<code>
'Foo'->hello()
</code>
and
<code>
bless(sub {}, 'Foo')->hello()
</code>
Besides the fact that the <i>bless</i>ed version can contain data, is that
just before the <i>bless</i>ed object is Garbage Collected,
DESTROY is called with it as the argument ($x->DESTROY). [mod://UNIVERSAL]
contains a DESTROY method, so it always exists.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-424604">
-- gam3<br/>
<small>A picture is worth a thousand words, but takes 200K.</small>
</div></div>
818866
818875