allow debug to be disabled via Env.
Marcus Ramberg [Thu, 3 Nov 2005 16:15:52 +0000 (16:15 +0000)]
Changes
lib/Catalyst.pm

diff --git a/Changes b/Changes
index 4d0dce8..833dc14 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Tis file documents the revision history for Perl extension Catalyst.
 
 5.50
+        - Allow debug to be disabled via ENV as well as enabled.
         - Added -scripts option to catalyst.pl for script updating
         - Changed helpers to default to long types, Controller instead of C
         - Added Catalyst::Controller, Catalyst::Model and Catalyst::View
index 66dd7d3..01b9e8d 100644 (file)
@@ -1563,7 +1563,12 @@ sub setup_log {
         $class->log( Catalyst::Log->new );
     }
 
-    if ( $ENV{CATALYST_DEBUG} || $ENV{ uc($class) . '_DEBUG' } || $debug ) {
+    
+    if ( $ENV{CATALYST_DEBUG} || 
+         $ENV{ Catalyst::Utils->class2env($class) . '_DEBUG' } || 
+         $debug  &&
+         $ENV{CATALYST_DEBUG} != 0 && 
+         $ENV{ Catalyst::Utils->class2env($class).'_DEBUG' } != 0 ) {
         no strict 'refs';
         *{"$class\::debug"} = sub { 1 };
         $class->log->debug('Debug messages enabled');