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*
In reply to Re: Single accessor/mutator idiom in Perl5, Perl6 and Python
by demerphq
in thread Single accessor/mutator idiom in Perl5, Perl6 and Python
by adrianh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |