http://www.perlmonks.org?node_id=375461

Generic Getter/Setter sub my_attribute { my $self = shift; @_ ? $attribute = shift : shift; }