sub foo { my ($this, $arg) = @_; $this->{foo} = $arg if defined $arg; return $this->{foo}; }