|P is for Practical|
Temporarily disabling overloaded operations.by BrowserUk (Pope)
|on Sep 15, 2003 at 06:04 UTC||Need Help??|
BrowserUk has asked for the
wisdom of the Perl Monks concerning the following question:
I have a class in which I am overloading stringification. However, it would be very useful if I could disable the overloading when I want to print stuff out for debugging purposes.
Currently, whenever I try to use print, warn, die etc., on $self, overload routes me to my stringify routine, which results in deep recursion if it that routine I happen to be try to get debug output from.
It also interferes with being able to use Abigail's Inside out objects technique.
Is there a smart dodge around this?
Examine what is said, not who speaks."Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.