$thing->foo(); $foo = $thing->foo($bar); #### $thing->get_foo(); $foo = $thing->set_foo($bar); #### sub foo { my $self = shift; if (@_) { if (defined wantarray) { croak "can't expect a return value when setting foo"; } # store foo = shift; } else { unless (defined wantarray) { croak "must expect a return value when fetching foo"; } # return foo member here } }