criticisms, comments on newest module please

nkuipers nkuipers at uvic.ca
Wed Jan 22 14:28:21 CST 2003


>sub AUTOLOAD {
>         (my $meth = our $AUTOLOAD) =~ s/.*:://;  # Untested
>         {id => 1, desc => 1, seq => 1}->{$meth} and return $_[0]->{$meth};
>         carp "Called undefined subroutine \"$meth\"";
>}

A couple of questions here.  First, is it common practice to catch accessor 
methods with AUTOLOAD()?  Second, I'm not familiar with the 
{id=>1,...}->{$meth} notation.  Is this effectively the same as

my %validcalls = (id=>1,desc=>1,seq=>1);
$validcalls{$meth} ? return $_[0]->$meth : carp ...;

Thanks,

Nathanael




More information about the Victoria-pm mailing list