Subject: | Code is not strict compliant. |
We're hoping to update perl blead to be strict compliant. IO::Zlib is a dual life module that needs updating first on CPAN.
I'm providing a patch that should make IO::Zlib strict compliant.
Subject: | Zlib.patch.txt |
diff --git a/ChangeLog b/ChangeLog
index f1a6dd4..4126722 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Sat Sep 12 22:00:00 2020 Todd Rinaldo <toddr@cpan.org>
+ * Make IO::Zlib strict compliant
+
Tue Jul 14 22:29:01 2009 Tom Hughes <tom@compton.nu>
* Zlib.pm
diff --git a/Makefile.PL b/Makefile.PL
index 66202b1..ce0c074 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,4 +1,5 @@
use ExtUtils::MakeMaker;
+use strict;
WriteMakefile(
NAME => 'IO::Zlib',
diff --git a/Zlib.pm b/Zlib.pm
index 55534b4..8fa04bc 100644
--- a/Zlib.pm
+++ b/Zlib.pm
@@ -5,8 +5,9 @@
# it and/or modify it under the same terms as Perl itself.
package IO::Zlib;
+use strict;
-$VERSION = "1.10";
+our $VERSION = "1.10";
=head1 NAME
@@ -285,8 +286,7 @@ it and/or modify it under the same terms as Perl itself.
require 5.006;
-use strict;
-use vars qw($VERSION $AUTOLOAD @ISA);
+our @ISA = qw(Tie::Handle);
use Carp;
use Fcntl qw(SEEK_SET);
@@ -407,8 +407,6 @@ sub import {
_alias($import);
}
-@ISA = qw(Tie::Handle);
-
sub TIEHANDLE
{
my $class = shift;
@@ -549,6 +547,7 @@ sub opened
return defined tied(*{$self})->{'file'};
}
+our $AUTOLOAD;
sub AUTOLOAD
{
my $self = shift;
diff --git a/t/basic.t b/t/basic.t
index 80aed9c..7da0f6b 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -1,3 +1,5 @@
+use strict;
+use warnings;
use IO::Zlib;
sub ok
@@ -11,15 +13,16 @@ sub ok
print "not ok $no\n" unless $ok ;
}
-$name="test.gz";
+my $name="test.gz";
print "1..17\n";
-$hello = <<EOM ;
+my $hello = <<EOM ;
hello world
this is a test
EOM
+my ($file, $uncomp);
ok(1, $file = IO::Zlib->new($name, "wb"));
ok(2, $file->print($hello));
ok(3, $file->opened());
diff --git a/t/external.t b/t/external.t
index 1d90d7f..a1bfc4c 100644
--- a/t/external.t
+++ b/t/external.t
@@ -3,6 +3,8 @@
# AND we have a useable /usr/bin directory.
# This limits the testing to UNIX-like
# systems but that should be enough.
+use strict;
+use warnings;
my $gzip = "/usr/bin/gzip";
@@ -86,13 +88,13 @@ ok(14, $@ =~ /^IO::Zlib::gzopen_external: mode 'xyz' is illegal /);
# The following is a copy of the basic.t, shifted up by 14 tests,
# the difference being that now we should be using the external gzip.
-$name="test.gz";
+my $name="test.gz";
-$hello = <<EOM ;
+my $hello = <<EOM ;
hello world
this is a test
EOM
-
+my ($file, $uncomp);
ok(15, $file = IO::Zlib->new($name, "wb"));
ok(16, $file->print($hello));
ok(17, $file->opened());
diff --git a/t/getc.t b/t/getc.t
index 2424d5b..3cd11c1 100644
--- a/t/getc.t
+++ b/t/getc.t
@@ -1,3 +1,5 @@
+use strict;
+use warnings;
use IO::Zlib;
sub ok
@@ -11,12 +13,12 @@ sub ok
print "not ok $no\n" unless $ok ;
}
-$name="test.gz";
+my $name="test.gz";
print "1..10\n";
-$text = "abcd";
-
+my $text = "abcd";
+my ($file);
ok(1, $file = IO::Zlib->new($name, "wb"));
ok(2, $file->print($text));
ok(3, $file->close());
diff --git a/t/getline.t b/t/getline.t
index fed17da..1981f14 100644
--- a/t/getline.t
+++ b/t/getline.t
@@ -1,3 +1,5 @@
+use strict;
+use warnings;
use IO::Zlib;
sub ok
@@ -11,11 +13,11 @@ sub ok
print "not ok $no\n" unless $ok ;
}
-$name="test.gz";
+my $name="test.gz";
print "1..23\n";
-@text = (<<EOM, <<EOM, <<EOM, <<EOM) ;
+my @text = (<<EOM, <<EOM, <<EOM, <<EOM) ;
this is line 1
EOM
the second line
@@ -25,8 +27,8 @@ EOM
the final line
EOM
-$text = join("", @text) ;
-
+my $text = join("", @text) ;
+my ($file, @lines);
ok(1, $file = IO::Zlib->new($name, "wb"));
ok(2, $file->print($text));
ok(3, $file->close());
diff --git a/t/import.t b/t/import.t
index 336d80a..8ca1e2b 100644
--- a/t/import.t
+++ b/t/import.t
@@ -1,3 +1,5 @@
+use strict;
+use warnings;
print "1..1\n";
sub ok
diff --git a/t/large.t b/t/large.t
index 0203182..09ff5e9 100644
--- a/t/large.t
+++ b/t/large.t
@@ -1,3 +1,5 @@
+use strict;
+use warnings;
use IO::Zlib;
sub ok
@@ -11,17 +13,17 @@ sub ok
print "not ok $no\n" unless $ok ;
}
-$name="test.gz";
+my $name="test.gz";
print "1..7\n";
-$contents = "";
+my $contents = "";
foreach (1 .. 5000)
{
$contents .= chr(int(rand(255)));
}
-
+my ($file, $uncomp);
ok(1, $file = IO::Zlib->new($name, "wb"));
ok(2, $file->print($contents));
ok(3, $file->close());
diff --git a/t/tied.t b/t/tied.t
index 029b282..ac01683 100644
--- a/t/tied.t
+++ b/t/tied.t
@@ -1,3 +1,5 @@
+use strict;
+use warnings;
use IO::Zlib;
sub ok
@@ -11,15 +13,16 @@ sub ok
print "not ok $no\n" unless $ok ;
}
-$name="test.gz";
+my $name="test.gz";
print "1..11\n";
-$hello = <<EOM ;
+my $hello = <<EOM ;
hello world
this is a test
EOM
+my ($uncomp);
ok(1, tie *OUT, "IO::Zlib", $name, "wb");
ok(2, printf OUT "%s - %d\n", "hello", 123);
ok(3, print OUT $hello);
diff --git a/t/uncomp1.t b/t/uncomp1.t
index 884af47..52a0f6d 100644
--- a/t/uncomp1.t
+++ b/t/uncomp1.t
@@ -1,3 +1,5 @@
+use strict;
+use warnings;
use IO::Zlib;
sub ok
@@ -13,12 +15,12 @@ sub ok
print "1..10\n";
-$hello = <<EOM ;
+my $hello = <<EOM ;
hello world
this is a test
EOM
-$name = "test$$";
+my $name = "test$$";
if (open(FH, ">$name")) {
binmode FH;
@@ -27,7 +29,7 @@ if (open(FH, ">$name")) {
} else {
die "$name: $!";
}
-
+my ($file, $uncomp);
ok(1, $file = IO::Zlib->new());
ok(2, $file->open($name, "rb"));
ok(3, !$file->eof());
diff --git a/t/uncomp2.t b/t/uncomp2.t
index e760fde..2ba8218 100644
--- a/t/uncomp2.t
+++ b/t/uncomp2.t
@@ -1,3 +1,5 @@
+use strict;
+use warnings;
require IO::Zlib; # uncomp2.t is like uncomp1.t but without 'use'
sub ok
@@ -13,12 +15,12 @@ sub ok
print "1..10\n";
-$hello = <<EOM ;
+my $hello = <<EOM ;
hello world
this is a test
EOM
-$name = "test$$";
+my $name = "test$$";
if (open(FH, ">$name")) {
binmode FH;
@@ -27,7 +29,7 @@ if (open(FH, ">$name")) {
} else {
die "$name: $!";
}
-
+my ($file, $uncomp);
ok(1, $file = IO::Zlib->new());
ok(2, $file->open($name, "rb"));
ok(3, !$file->eof());