Subject: | [WISHLIST] DEBUG and warn (not print) |
Date: | Tue, 27 May 2008 23:43:23 -0300 |
To: | "Andy Lester" <andy [...] petdance.com>, bug-Locale-Maketext [...] rt.cpan.org |
From: | "Adriano Ferreira" <aferreira [...] shopzilla.com> |
When I tried to turn on debugging on Locale::Maketext (as in File::Findgrep with
sub Locale::Maketext::DEBUG () {1}
before the "use Locale::Maketext", I run into trouble in a web
application because the debugging messages use the pattern
DEBUG and print @message;
sending the details into STDOUT. This conflicted with the app
generating the HTML page into STDOUT as well. And there is a couple of
details to make it hard to surpass: "print" is not overridable (so
redefining it for Locale::Maketext is out of question).
The attached patch turns all these debugging mechanism into:
DEBUG and warn @message;
"warn" is much easier to catch and there is already the $SIG{__WARN__}
hook if one needs it. It also spits messages into STDERR, which makes
unnecessary any modification to debug a usual web application.
Best,
Adriano.
Message body is not shown because sender requested not to inline it.