aplonis has asked for the wisdom of the Perl Monks concerning the following question:
Suppose I have a sub...
sub foo { print 'Foo!' )...which I embed into some other sub as a ref...
\&fooHow might I manage to later redefine the action of &foo, such that when &foo gets called via its original ref, the new action is done, not the old?
The reason is that I have two actions to alternate between, depending upon something else. And whether or not this is the best way, I'd still like to know how to do it this way. That is, if it can be done at all. TIA
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Redefine the sub of a subref?
by Corion (Patriarch) on Feb 04, 2017 at 14:08 UTC | |
|
Re: Redefine the sub of a subref?
by haukex (Archbishop) on Feb 04, 2017 at 14:13 UTC | |
by aplonis (Pilgrim) on Feb 05, 2017 at 03:34 UTC |