sub accessor { my $self = shift; if (@_) { # Sets the attribute. $$self{key} = shift; return $self; } return $$self{key}; # Gets the attribute. }