sub AUTOLOAD { my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::')+2); my $code_ref = File::Samba->can($method); if (!$code_ref) { require Carp; Carp::croak("Undefined subroutine $method called"); } # Don't create stub functions to avoid # clearing perl's method cache repeatedly. # See http://www.perlmonks.org/?node_id=505443 # This only works with methods, # and only if they are non-static. local $_[0] = ident $_[0]; goto($code_ref); }