note
Limbic~Region
[pobocks],
<br />
There is heated debate regarding chained methods as well as a method returning a reference to the object (good idea or not) but it works like this (traditional perl OO):
<CODE>
sub legs {
my ($self, $attribute, $val) = @_;
$self->{legs}{$attribute} = $val;
return $self;
}
sub eyes {
my ($self, $attribute, $val) = @_;
$self->{eyes}{$attribute} = $val;
return $self;
}
</CODE>
<p>
In other words, the method returns the object so you can then invoke another method on the return value and then assign the return value of that chained method back to the original scalar holding a reference to the object. I made minor updates to this node soon after submitting as I hadn't seen the original code in the root thread.
</p>
<div class="pmsig"><div class="pmsig-180961">
<p>
Cheers - [Limbic~Region|L~R]
</p>
</div></div>
737084
737106