note
demerphq
<!--
<p><em></em></p>
<code></code>
<i></i>
<b></b>
[ ]
-->
<p>
I found this whole thread interesting. When i read the title I thought "yep, I agree with that" but then on reading closer it wasnt even what I was thinking at all! :-) What I thought you meant was all those aweful sub like
</p>
<code>
sub get_foo {
my $self=shift;
return $self->{foo};
}
</code>
<p>
and its correspondingly ugly set_foo. If you <i>had</i> been talking about those being evil then i would agree. :-) Perl offers fancier and IMO more intuitive ways to do things:
</p>
<code>
sub foo {
my $self=shift;
if (@_) {
$self->{foo}=shift;
return $self;
} else {
return $self->{foo}
}
}
</code>
<p>
(or a variant thereof, you can golf it down nicely. :-)
</p>
<br />
<div class="pmsig"><div class="pmsig-108447">
---
<br />
demerphq<br />
<br />
<sub>
<ol>
<p><em>First they ignore you, then they laugh at you, then they fight you, then you win.
</em><br /> -- Gandhi</p>
</ol>
</sub>
</div></div>
<!--
<hr />
<sub>
<p>
<strong>• Update: </strong><br />
</p>
</sub>
-->
<br />
309952
309952