in reply to Re: Detecting Overridden Methods
in thread Detecting Overridden Methods

The code in the parent post is neither inheritable nor importable. Fix:

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; }

Replies are listed 'Best First'.
Re^3: Detecting Overridden Methods
by Anonymous Monk on Feb 08, 2007 at 23:58 UTC
    Doesn't use List::Util qw( first ); generate an unwanted first() "method" (actually, a function) that is inherited to all children? I would have coded this as use List::Util (); and return List::Util::first { $_->can($method) } @$isa;.