in reply to Re^3: Using SUPER in dynamically generated subs
in thread Using SUPER in dynamically generated subs

You're absolutely right - I misread the error message. The problem was not that it didn't look at the right @ISA but that I was using an anonymous sub.

When I called it like this:

my ($class,$alias_for) = @_; install_sub( $class, 'find_ids', sub { my ($class,$params) = @_; do_something_with($alias_for); # Pass the subname to super, because # this is an anonymous sub my $super = $class->super('find_ids'); return $super->($class,$params); }); ....

... then it works perfectly. And when I benchmarked the overhead of using SUPER, there was only a 1% slowdown.

. Thanks Diotalevi

UPDATE My benchmark was wrong. See Re^6: Using SUPER in dynamically generated subs for correct benchmarks

Replies are listed 'Best First'.
Re^5: Using SUPER in dynamically generated subs
by chromatic (Archbishop) on Nov 13, 2006 at 20:47 UTC

    If you named your anonymous sub, you could use the SUPER module again, with something like:

    local *__ANON__ = $alias_for;