http://qs321.pair.com?node_id=208955


in reply to Re: $functions xor $methods
in thread $functions xor $methods

Only problem is that it requires a hardcoded 'parent' value (unless theres some way to return that?)
sub AUTOLOAD { if(defined &{__PARENT__::$AUTOLOAD}) { goto &{__PARENT__::$AUTOLOAD} } }
(note i left out the part about getting the right value in $AUTOLOAD, chopping out the package and stuff)

Replies are listed 'Best First'.
Re: Re: Re: $functions xor $methods
by dada (Chaplain) on Oct 30, 2002 at 11:34 UTC
    something like this seems to work and doesn't require hardcoded names. it just grabs the first parent method (in @ISA order) it finds:
    sub AUTOLOAD { no strict; my $METHOD; ($METHOD = $AUTOLOAD) =~ s/.*:://; foreach my $PARENT (@ISA) { if(defined &{$PARENT.'::'.$METHOD}) { goto &{$PARENT.'::'.$METHOD} } } }
    either this, or use Damian's NEXT module.

    cheers,
    Aldo

    King of Laziness, Wizard of Impatience, Lord of Hubris

Re: Re: Re: $functions xor $methods
by the pusher robot (Monk) on Oct 31, 2002 at 00:03 UTC
    SUPER::$AUTOLOAD should work.