Subject: | Use of uninitialized value $opt[0] |
Hi, using this module will trigger a warning:
Use of uninitialized value $opt[0] in string eq at /home/niko/tmp/libxml-commonns-perl/blib/lib/XML/CommonNS.pm line 55.
Trivial patch attached.
Subject: | 0001-Fix-a-warning-about-an-uninitialized-value.patch |
From f6bedaae4fb2f0c6171e2610b7ca7071264c472d Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Thu, 18 Sep 2014 00:00:29 +0300
Subject: [PATCH] Fix a warning about an uninitialized value
---
lib/XML/CommonNS.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/XML/CommonNS.pm b/lib/XML/CommonNS.pm
index e1cca02..8e253d0 100644
--- a/lib/XML/CommonNS.pm
+++ b/lib/XML/CommonNS.pm
@@ -52,7 +52,7 @@ sub import {
my @opt = @_;
no strict 'refs';
- @opt = keys %NS if $opt[0] eq ':all';
+ @opt = keys %NS if @opt and $opt[0] eq ':all';
for my $exp (@opt) {
die "No namespace available for key $exp" unless exists $NS{$exp};
__PACKAGE__->uri($exp);
--
2.1.0