fokat has asked for the wisdom of the Perl Monks concerning the following question:
Fellow monks:
I come before you to request the help of your collective wisdom for this problem...
For a module I am writing, I want to create a kind of filter that removes extraneous data from the calls to methods that are defined by third party modules. In this particular example, I am failing miserably to do so with warnings::warn
*clone_warn = *warnings::warn; *warnings::warn = sub { print "Look ma!\n"; clone_warn(some_filter_function_i_provide @_); };
The problem is that as soon as I change warnings::warn, the alias I keep in clone_warn also changes, as would be expected. I've also tried any number of combinations of code references, closures, GLOBs to no avail.
What I want to achieve is the redefinition of the original function (warnings::warn) while keeping a reference to the original implementation, so that I can call it from my version. This is similar in concept to a proxy method or a call to ->SUPER::foo() in OO terms.
How can I achieve this? There has to be a way to do it...
Best regards
-lem, but some call me fokat
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to stack a call to a class method
by Aristotle (Chancellor) on Mar 03, 2003 at 04:57 UTC | |
|
Re: How to stack a call to a class method
by demerphq (Chancellor) on Mar 03, 2003 at 13:23 UTC | |
by belden (Friar) on Mar 03, 2003 at 21:39 UTC | |
by demerphq (Chancellor) on Mar 04, 2003 at 09:23 UTC | |
by belden (Friar) on Mar 08, 2003 at 18:15 UTC | |
by fokat (Deacon) on Mar 03, 2003 at 17:24 UTC |