package Foo; use strict; use warnings; use Sub::Name; # forward declarations so AUTOLOAD can limit what works use subs qw( func funk ); $\ = "\n"; sub show { print join "\t", (caller(0))[0..3]; } sub AUTOLOAD { my ( $name ) = our $AUTOLOAD =~ /::(\w+)$/; return unless __PACKAGE__->can( $name ); # only allow those subs listed above my $fullname = __PACKAGE__ . '::' . $name; no strict 'refs'; *{ $fullname } = Sub::Name::subname $fullname => *show; goto &$fullname; } 1; #### #!/bin/env perl use strict; use warnings; use Foo(); Foo::show(); Foo::func(); Foo::funk();