Subject: | Silence "Used only once" warning with $DEBUG |
This patch silences the "used only once" warning which accessing the
calling package's $DEBUG variable will generate if said variable does
not exist. "no warnings 'once';' would also work, though that does
impose a Perl 5.6 minimum version requirement.
Subject: | 0001-Worked-around-used-only-once-warning-with-DEBUG.patch |
From 89bfcc6853dd4df75ee7f596ac87bc2c3412dd4e Mon Sep 17 00:00:00 2001
From: chromatic <chromatic@wgz.org>
Date: Fri, 24 Feb 2012 16:12:02 -0800
Subject: [PATCH] Worked around 'used only once' warning with $DEBUG.
---
lib/Class/Base.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/Class/Base.pm b/lib/Class/Base.pm
index aa9c157..cdcdb19 100644
--- a/lib/Class/Base.pm
+++ b/lib/Class/Base.pm
@@ -48,7 +48,7 @@ sub new {
? $config->{ debug }
: defined $config->{ DEBUG }
? $config->{ DEBUG }
- : ( ${"$class\::DEBUG"} || 0 );
+ : ( do { local $^W; ${"$class\::DEBUG"} } || 0 );
my $self = bless {
_ID => $config->{ id } || $config->{ ID } || $class,
--
1.7.4.1