in reply to Re: goto superclass method
in thread goto superclass method

search_isa() is simply @ISA, because can searches the whole inheritance tree of the supplied class.

use strict; use warnings; package AA; sub dostuff { print(scalar(caller()), $/); } package BB; package CC; BEGIN { our @ISA = 'AA'; } package DD; use vars qw(@ISA); BEGIN { @ISA = qw(BB CC); } sub dostuff { foreach my $super (@ISA) { #if (my $method = $super->can('dostuff')) { # -or- if (my $method = UNIVERSAL::can($super, 'dostuff')) { #print($super, $/); #print($method, $/); goto $method; } } } package main; #print(\&AA::dostuff, $/); bless({},'DD')->dostuff(); # Prints "main"

Replies are listed 'Best First'.
Re^3: goto superclass method
by Ovid (Cardinal) on Dec 22, 2004 at 18:29 UTC

    search_isa() is simply @ISA, because can searches the whole inheritance tree of the supplied class.

    D'oh! I knew that. Silly me :)

    Cheers,
    Ovid

    New address of my CGI Course.