Subject: | use of lc on undef in Net::XMPP::Debug |
I'm seeing messages like this in the Net::Jabber::Bot test suite when testing against perl 5.12.
The attached patch will correct the problem
Use of uninitialized value $args{"file"} in lc at /usr/local/lib/perl5/site_lib/Net/XMPP/Debug.pm
line 154.
Subject: | patch.txt |
diff --git a/lib/Net/XMPP/Debug.pm b/lib/Net/XMPP/Debug.pm
index eb18d70..8319115 100644
--- a/lib/Net/XMPP/Debug.pm
+++ b/lib/Net/XMPP/Debug.pm
@@ -149,9 +149,11 @@ sub Init
my $self = shift;
my %args;
- while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); }
+ while($#_ >= 1) { # Protect against an uneven number of parameters being passed in.
+ $args{ lc pop(@_) } = pop(@_);
+ }
- delete($args{file}) if (lc($args{file}) eq "stdout");
+ delete($args{file}) if ($args{file} && lc($args{file}) eq "stdout");
$args{time} = 0 if !exists($args{time});
$args{setdefault} = 0 if !exists($args{setdefault});