Fix Perl 5.18 experimental warnings
authorHeiko Schlittermann (JUMPER) <hs@schlittermann.de>
Wed, 13 May 2015 14:58:27 +0200
changeset 124 87081e9cf3ba
parent 115 0d4074ac2eee
child 125 41872269ca6f
Fix Perl 5.18 experimental warnings
bin/imager.compress
bin/imager.save
lib/Imager.pm
t/001-save-restore.t
--- a/bin/imager.compress	Mon Jun 18 14:36:13 2012 +0200
+++ b/bin/imager.compress	Wed May 13 14:58:27 2015 +0200
@@ -77,14 +77,16 @@
             }
 
             close $tmp;
-            unlink $tmp, $_;
+            map { unlink } $tmp, $_;
 
-            return;
+            return 0;
 
         },
         @ARGV
     );
 
+    exit 0;
+
 }
 
 __END__
--- a/bin/imager.save	Mon Jun 18 14:36:13 2012 +0200
+++ b/bin/imager.save	Wed May 13 14:58:27 2015 +0200
@@ -15,6 +15,7 @@
 use Getopt::Long;
 use Pod::Usage;
 use Imager 0.1;
+use if $^V >= v5.18 => (experimental => qw'lexical_topic smartmatch');
 
 use constant KiB      => 1024;
 use constant MiB      => 1024 * KiB;
--- a/lib/Imager.pm	Mon Jun 18 14:36:13 2012 +0200
+++ b/lib/Imager.pm	Wed May 13 14:58:27 2015 +0200
@@ -4,6 +4,7 @@
 use warnings;
 use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
 use autodie qw(:all);
+use if $^V >= v5.18 => (experimental => 'smartmatch');
 
 our $VERSION = "0.1";
 
--- a/t/001-save-restore.t	Mon Jun 18 14:36:13 2012 +0200
+++ b/t/001-save-restore.t	Wed May 13 14:58:27 2015 +0200
@@ -4,6 +4,7 @@
 use autodie qw(:all);
 use Test::More;
 use Sys::Hostname;
+use if $^V gt v5.18 => (experimental => 'smartmatch');
 
 use constant SIZE => 27 * 1024 * 1024;
 
@@ -37,6 +38,7 @@
 
 # now compress and check again
 system("perl -Mblib blib/script/imager.compress $dir/images 2>$err");
+is($? => 0, "compressed") or do { seek $err => 0, 0; diag <$err> };
 system("perl -Mblib blib/script/imager.restore $dir/images/idx/@{[hostname]}/source/* $dir/source.restored");
 is($? => 0, "restored") or do { seek $err => 0, 0; diag <$err> };
 seek($out, 0, 0);