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.
In reply to Re: Hijacking a method
by DStaal
in thread Hijacking a method
by Transient
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |