3c3f571
From c950d6fa306a1a0a1e28ece3646aec9490a7ea0e Mon Sep 17 00:00:00 2001
3c3f571
From: James E Keenan <jkeenan@cpan.org>
3c3f571
Date: Sat, 15 Dec 2018 10:29:12 -0500
3c3f571
Subject: [PATCH] Avoid "Use of uninitialized value $res in numeric eq (==)"
3c3f571
 warning
3c3f571
MIME-Version: 1.0
3c3f571
Content-Type: text/plain; charset=UTF-8
3c3f571
Content-Transfer-Encoding: 8bit
3c3f571
3c3f571
The test within the SKIP block expects $res to be undef, but the 'skip'
3c3f571
condition itself expects it to be defined and numeric.  So we were
3c3f571
getting an uninitialized value warning.  In 'skip' condition, test for
3c3f571
definedness before numeric comparison.
3c3f571
3c3f571
Signed-off-by: Petr Písař <ppisar@redhat.com>
3c3f571
---
3c3f571
 ext/GDBM_File/t/fatal.t | 2 +-
3c3f571
 1 file changed, 1 insertion(+), 1 deletion(-)
3c3f571
3c3f571
diff --git a/ext/GDBM_File/t/fatal.t b/ext/GDBM_File/t/fatal.t
3c3f571
index 01068f3cf4..1cbfdc6018 100644
3c3f571
--- a/ext/GDBM_File/t/fatal.t
3c3f571
+++ b/ext/GDBM_File/t/fatal.t
3c3f571
@@ -52,7 +52,7 @@ my $res = eval {
3c3f571
 };
3c3f571
 
3c3f571
 SKIP: {
3c3f571
-    skip "Can't trigger failure", 2 if $res == 99;
3c3f571
+    skip "Can't trigger failure", 2 if (defined $res and $res == 99);
3c3f571
 
3c3f571
     is $res, undef, "eval should return undef";
3c3f571
 
3c3f571
-- 
3c3f571
2.17.2
3c3f571