in reply to Sub getting it's own CODE ref? Proto-OO

I'm not sure I fully understand what you're doing here, but it may be possible to simplify the problem by modifying the dispatcher - something like (simplified):

sub dispatch { my($self, $code) = (shift, shift); push @{ $self->{running} }, $code; my $result = eval { &$code($self, @_) }; pop @{ $self->{running} }; die if $@; return $result; }

It gets slightly more complex when you properly allow for context using wantarray, but this will allow super() to inspect information in the object itself to determine whence it was called.

Hugo

Replies are listed 'Best First'.
Re^2: Sub getting it's own CODE ref? Proto-OO
by bsb (Priest) on Jun 17, 2004 at 01:16 UTC
    Something like this could work. I wonder if I can avoid maintaining the stack in the majority of calls that don't use super, probably not.

    I also need to work out all the corner cases to be sure that it can't be confused. If an accessor calls another accessor via super, etc.

    Thank you