On 6/8/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:
On Thu, 2006-08-06 at 10:56 -0700, Anthony Ettinger wrote:
> i prefer the return once method:
>
> sub foo
> {
> my $self = shift;
> if (@_ == 1) { $self->{'foo'} = shift; }
>
> return $self->{'foo'};
> }
I would prefer it to return the old value:
sub foo {
my $self = shift;
my $old_foo = $self->{'foo'};
$self->{'foo'} = shift if @_ > 0;
return $old_foo;
}
--
__END__
Just my 0.00000002 million dollars worth,
--- Shawn
If you set a new value, why would you want your client to still be
using the old value?
--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>