in reply to Detecting Overridden Methods

perl -e 'package B; sub foo {}; sub bar {}; package A; @A::ISA="B"; sub bar {}; sub baz {}; for (qw(foo bar baz)) { print "$_: " .(A->can($_) == B->can($_) ? " same" : " overwritten") ."\n"}'

Prints
foo: same bar: overwritten baz: overwritten


Not sure if that is what you are looking for.

my @a=qw(random brilliant braindead); print $a[rand(@a)];

Replies are listed 'Best First'.
Re^2: Detecting Overridden Methods
by Rhandom (Curate) on Feb 05, 2007 at 18:47 UTC
    Ah - I see. You don't want to hard code the classes. My Bad. Then yes - you'll have to look at @A::ISA - but only @A::ISA.

    for my $i (@A::ISA) { for (qw(foo bar baz)) { print "$_: " .(A->can($_) == $i->can($_) ? " same" : " overwritten") ."\n"; } }


    my @a=qw(random brilliant braindead); print $a[rand(@a)];