in reply to Re: tying hashes and SUPER
in thread tying hashes and SUPER

Ugh. You need to escape the sigil in $self. I'd rather use a closure to prevent me from having to be so clever:

for my $method ( qw/ TIEHASH STORE FETCH FIRSTKEY NEXTKEY EXISTS CLEAR DELETE UNTIE DESTROY / ) { no strict 'refs'; my $super = 'SUPER::' . $method; *{ $method } = sub { my $self = shift; notify( $method ); $self->$super( @_ ); }; }

That's also untested. Mixing SUPER and autogenerated methods makes it a little knotty.

Replies are listed 'Best First'.
Re^3: tying hashes and SUPER
by particle (Vicar) on Apr 17, 2003 at 13:46 UTC

    ahh, much better. i was able to fix the minor bugs in dws's solution, but i like your method better. much more straightforward to muck with the symbol table than to exploit eval

    ~Particle *accelerates*