in reply to Perl Naming Conventions
For object attribute accessor methods like this, I prefer this idiom:
sub value { my $self = shift; return $self->{value} if not @_; $self->{value} = shift; }
Thus, you can say $x = $o->value, or $o->value(5);.
--
[ e d @ h a l l e y . c c ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Perl Naming Conventions
by Anonymous Monk on Apr 28, 2003 at 19:22 UTC | |
by halley (Prior) on Apr 28, 2003 at 19:51 UTC | |
|
Re: Re: Perl Naming Conventions
by Anonymous Monk on Apr 28, 2003 at 19:42 UTC |