Here's what I did when trying to use closures (I hadn't seen the issue with the double $self at the time):
So I felt that with all the lexicals and the use of many "advanced" features (anonymous sub, closing over a lexical, globs, scalar as a method, SUPER::) it was harder to read than a string eval which is often better understood. Your version is light enough that I like it more though.{ no strict; for my $method (qw(STORE CLEAR PUSH POP SHIFT UNSHIFT)) { my $sub = "SUPER::$method"; *$method = sub { &main::trigger; my $self = shift; $self->$sub($se +lf, @_) }; } }
It's up to Discipulus to choose whatever he thinks he'll be able to understand the best :)
In reply to Re^3: Is tie inteded to be used in this way?
by Eily
in thread Is tie inteded to be used in this way?
by Discipulus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |