in reply to Re: goto and AUTOLOADed methods
in thread goto and AUTOLOADed methods

That breaks because you've shifted $self off the stack so it's no longer the first argument when you goto $method.

The question is really about, how to avoid leaving an entry for the AUTOLOAD subroutine on the call stack. There's a well established way of doing it when you're AUTOLOADing functions but I've never seen an example of AUTOLOADing methods used the magic stack fixing goto. Is this because there's some subtle problem I've missed or is it just because nobody has bothered?

Replies are listed 'Best First'.
Re: Re: Re: goto and AUTOLOADed methods
by ctilmes (Vicar) on Aug 01, 2003 at 11:35 UTC
    Ok, I fixed that. Just grab the first argument as $_[0], do whatever you want with it to figure out what method you need to call, require other modules, build a new sub, etc., then just use goto to call the method you want with the arguments (including the object) intact. The goto will mimic a method call just like you want it to.