in reply to Hijacking a method
Probably the 'cleanest' way to do this would be to sub-class the object's class, and a create a method that does the logging and calls the parent's method. Something like this:
package Sub::Object; use base qw(Orig::Obj); sub doSomething { my $self = shift @_; $myFunkyLogMachine->Log("hi!"); my $value = $self->SUPER::doSomething(@_); $myFunkyLogMachine->Log("hi!"); return $value; }
Then you would just use Sub::Object in place of Orig::Obj and you'd get the logging.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Hijacking a method
by Transient (Hermit) on Jun 17, 2009 at 17:05 UTC | |
by DStaal (Chaplain) on Jun 17, 2009 at 20:08 UTC |