use 5.010; use mro; # Make next::can available. use Sub::Name (); # Used to make next::can work # in anonymous subroutines. sub AUTOLOAD { my ($bottom_class, $method) = $AUTOLOAD =~ /(.*)::(.*)/s; # Note the /s above. It's legal to have # newlines in packages and symbols. my $next = Sub::Name::subname( $method => sub { $bottom_class->next::can } )->(); goto &$next if $next; ...; }