use List::Util qw( first ); sub check { my ($self, $method) = @_; my $class = ref($self) || $self; my $isa = do { no strict 'refs'; \@{$class.'::ISA'} }; return first { $_->can($method) } @$isa; }