Transient has asked for the wisdom of the Perl Monks concerning the following question:
and the end result might be this:$obj->doSomething();
$myFunkyLogMachine->Log("hi!"); $obj->doSomething(); $myFunkyLogMachine->Log("bye!");
*obj::doSomething2 = \&obj::doSomething; *obj::doSomething = sub { $myFunkyLogMachine->Log("hi!"); $obj->doSome +thing2(@_); $myFunkyLogMachine->Log("bye!"); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Hijacking a method
by lostjimmy (Chaplain) on Jun 17, 2009 at 17:06 UTC | |
by Transient (Hermit) on Jun 17, 2009 at 17:14 UTC | |
by lostjimmy (Chaplain) on Jun 17, 2009 at 18:32 UTC | |
by jettero (Monsignor) on Jun 17, 2009 at 17:50 UTC | |
Re: Hijacking a method
by ELISHEVA (Prior) on Jun 17, 2009 at 17:15 UTC | |
Re: Hijacking a method
by DStaal (Chaplain) on Jun 17, 2009 at 16:58 UTC | |
by Transient (Hermit) on Jun 17, 2009 at 17:05 UTC | |
by DStaal (Chaplain) on Jun 17, 2009 at 20:08 UTC | |
Re: Hijacking a method
by Unforgiven (Hermit) on Jun 17, 2009 at 16:57 UTC |