our $AUTOLOAD; sub AUTOLOAD { my $self = shift; ref($self) or return; # Non-OO/Not an autoloaded method..? return if ( $AUTOLOAD =~ /DESTROY/ ); # don't mess with garbage collection ( my $method = $AUTOLOAD ) =~ s{.*::}{}; my ( $code, $name, $ATTRname ); if ( $method =~ /get_(\w+)/ ) { my $ATTRname = lc($1); # Could possibly do a check to make sure we have one of a group of specific # attributes with. # # if ( $ATTRname =~ /^(?:html_error_string|error_type|password_valid|user_id # |other|stuff|you|want|to|access)$/x # ) {} no strict qw{refs}; # create and register the method *{$AUTOLOAD} = sub { my $self = shift; return $self->{$ATTRname}; }; unshift @_, $self; goto &{$AUTOLOAD}; } return; }