http://qs1969.pair.com?node_id=291493

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.