use strict; use Carp; use constant { PREFIX => 1, SUFFIX => 2, TRUST => 3, DATE => 4, BUSINESS => 5, }; sub AUTOLOAD { my $self = shift @_; my $method = $AUTOLOAD; $method =~ s/.*:://; return if $method eq "DESTROY"; if ( $method !~ m/^Is(.+)$/ ) { confess "method = $method is not supported by AUTOLOAD!\n"; } my $token_type_value = eval( uc($1) ); if ( $@ ) { confess "invalid token type $1!\n"; } my ($token) = @_; return $self->_IsToken($token, $token_type_value); }