use mro; sub find_implementor { my ($class, $method) = @_; for my $parent (@{ mro::get_linear_isa($class) }) { no strict 'refs'; return $parent if exists( &{"${parent}::$method"} ); } return 'UNIVERSAL' if UNIVERSAL->can($method); return find_implementor($class, 'AUTOLOAD') if $method ne 'AUTOLOAD' && $class->can($method); return undef; }