in reply to Single accessor/mutator idiom in Perl5, Perl6 and Python
In Perl5 you would do it something like this:
define givenName { my $self = shift; $self->{_givenName} = shift if @_; return $self->{_givenName}; };
Umm, define? ;-)
sub givenName { $_[0]->{_givenName} = $_[1] if @_>1; $_[0]->{_givenName}; };
*grin*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Single accessor/mutator idiom in Perl5, Perl6 and Python
by adrianh (Chancellor) on Aug 17, 2003 at 15:53 UTC |