sub new { my $class = shift; my %args = @_; my %hash = ( _foo => 0, _bar => 0, _baz => 0, ); my $self = bless( \%hash, $class ); ... return $self; } sub AUTOLOAD { # do stuff to auto-generate accessors for anything in my %hash (except without preceding underscore), so "foo" and "bar" } sub baz { # actually verify input data here }