diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-05-18 20:23:39 +0100 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-06-09 12:17:09 +0100 |
commit | c23ee15d0c5621f673a78a873392c506a2b470f8 (patch) | |
tree | 195ef8040c019d78ea7633423a753075342868fc /cpan | |
parent | 882c7064de216e4687c6d4721e523ecd1f05c78a (diff) | |
download | perl-c23ee15d0c5621f673a78a873392c506a2b470f8.tar.gz |
Updated IO-Compress to CPAN version 2.035
[DELTA]
2.035 6 May 2011
* RT #67931: Test failure on Windows
2.034 2 May 2011
* Compress::Zlib
- Silence pod warnings.
[RT# 64876]
- Removed duplicate words in pod.
* IO::Compress::Base
- RT #56942: Testsuite fails when being run in parallel
- Reduce symbol import - patch from J. Nick Koston
- If the output buffer parameter passed to read has a value of
undef, and Append mode was specified when the file was opened,
and eof is reached, then the buffer paramer was left as undef.
This is different from when Append isn't specified - the buffer
parameter is set to an empty string.
- There area couple of issues with reading a file that contains an
empty file that is compressed.
Create with -- touch /tmp/empty; gzip /tmp/empty.
Issue 1 - eof is not true immediately. Have to read from the file
to trigger eof.
Issue 2 - readline incorrectly returns an empty string the first
time it is called, and (correctly) undef thereafter.
[RT #67554]
Diffstat (limited to 'cpan')
46 files changed, 571 insertions, 348 deletions
diff --git a/cpan/IO-Compress/Changes b/cpan/IO-Compress/Changes index 464540e940..7bdccb473c 100644 --- a/cpan/IO-Compress/Changes +++ b/cpan/IO-Compress/Changes @@ -1,7 +1,41 @@ CHANGES ------- + 2.035 6 May 2011 + + * RT #67931: Test failure on Windows + + 2.034 2 May 2011 + + * Compress::Zlib + - Silence pod warnings. + [RT# 64876] + + - Removed duplicate words in pod. + + * IO::Compress::Base + + - RT #56942: Testsuite fails when being run in parallel + + - Reduce symbol import - patch from J. Nick Koston + + - If the output buffer parameter passed to read has a value of + undef, and Append mode was specified when the file was opened, + and eof is reached, then the buffer paramer was left as undef. + This is different from when Append isn't specified - the buffer + parameter is set to an empty string. + + - There area couple of issues with reading a file that contains an + empty file that is compressed. + Create with -- touch /tmp/empty; gzip /tmp/empty. + Issue 1 - eof is not true immediately. Have to read from the file + to trigger eof. + Issue 2 - readline incorrectly returns an empty string the first + time it is called, and (correctly) undef thereafter. + [RT #67554] + 2.033 11 Jan 2011 + * Fixed typos & spelling errors. [perl# 81816] diff --git a/cpan/IO-Compress/Makefile.PL b/cpan/IO-Compress/Makefile.PL index fceaea351f..057af8d2d7 100644 --- a/cpan/IO-Compress/Makefile.PL +++ b/cpan/IO-Compress/Makefile.PL @@ -3,7 +3,7 @@ use strict ; require 5.004 ; -$::VERSION = '2.033' ; +$::VERSION = '2.035' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; diff --git a/cpan/IO-Compress/README b/cpan/IO-Compress/README index 68971823b6..f457061faf 100644 --- a/cpan/IO-Compress/README +++ b/cpan/IO-Compress/README @@ -1,9 +1,9 @@ IO-Compress - Version 2.033 + Version 2.035 - 11th January 2011 + 6th May 2011 Copyright (c) 1995-2011 Paul Marquess. All rights reserved. This program is free software; you can redistribute it @@ -89,7 +89,7 @@ To help me help you, I need all of the following information: If you haven't installed IO-Compress then search IO::Compress::Gzip.pm for a line like this: - $VERSION = "2.033" ; + $VERSION = "2.035" ; 2. If you are having problems building IO-Compress, send me a complete log of what happened. Start by unpacking the IO-Compress diff --git a/cpan/IO-Compress/lib/Compress/Zlib.pm b/cpan/IO-Compress/lib/Compress/Zlib.pm index db206366b5..b8bad72196 100644 --- a/cpan/IO-Compress/lib/Compress/Zlib.pm +++ b/cpan/IO-Compress/lib/Compress/Zlib.pm @@ -7,17 +7,17 @@ use Carp ; use IO::Handle ; use Scalar::Util qw(dualvar); -use IO::Compress::Base::Common 2.033 ; -use Compress::Raw::Zlib 2.033 ; -use IO::Compress::Gzip 2.033 ; -use IO::Uncompress::Gunzip 2.033 ; +use IO::Compress::Base::Common 2.035 ; +use Compress::Raw::Zlib 2.035 ; +use IO::Compress::Gzip 2.035 ; +use IO::Uncompress::Gunzip 2.035 ; use strict ; use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = '2.033'; +$VERSION = '2.035'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -87,15 +87,16 @@ sub _set_gzerr_undef _set_gzerr(@_); return undef; } + sub _save_gzerr { my $gz = shift ; my $test_eof = shift ; my $value = $gz->errorNo() || 0 ; + my $eof = $gz->eof() ; if ($test_eof) { - #my $gz = $self->[0] ; # gzread uses Z_STREAM_END to denote a successful end $value = Z_STREAM_END() if $gz->eof() && $value == 0 ; } @@ -162,13 +163,14 @@ sub Compress::Zlib::gzFile::gzread my $len = defined $_[1] ? $_[1] : 4096 ; + my $gz = $self->[0] ; if ($self->gzeof() || $len == 0) { # Zap the output buffer to match ver 1 behaviour. $_[0] = "" ; + _save_gzerr($gz, 1); return 0 ; } - my $gz = $self->[0] ; my $status = $gz->read($_[0], $len) ; _save_gzerr($gz, 1); return $status ; @@ -451,7 +453,7 @@ sub inflate package Compress::Zlib ; -use IO::Compress::Gzip::Constants 2.033 ; +use IO::Compress::Gzip::Constants 2.035 ; sub memGzip($) { @@ -698,7 +700,7 @@ enhancements/changes have been made to the C<gzopen> interface: =item 1 -If you want to to open either STDIN or STDOUT with C<gzopen>, you can now +If you want to open either STDIN or STDOUT with C<gzopen>, you can now optionally use the special filename "C<->" as a synonym for C<\*STDIN> and C<\*STDOUT>. diff --git a/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm b/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm index c3718d1f0d..72de92cd1e 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm @@ -4,13 +4,13 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.033 qw(:Status); +use IO::Compress::Base::Common 2.035 qw(:Status); #use Compress::Bzip2 ; -use Compress::Raw::Bzip2 2.033 ; +use Compress::Raw::Bzip2 2.035 ; our ($VERSION); -$VERSION = '2.033'; +$VERSION = '2.035'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm b/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm index 33e56d08a0..568740655e 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.033 qw(:Status); +use IO::Compress::Base::Common 2.035 qw(:Status); -use Compress::Raw::Zlib 2.033 qw(Z_OK Z_FINISH MAX_WBITS) ; +use Compress::Raw::Zlib 2.035 qw(Z_OK Z_FINISH MAX_WBITS) ; our ($VERSION); -$VERSION = '2.033'; +$VERSION = '2.035'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm b/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm index 21a0be4108..59333d7227 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm @@ -4,10 +4,10 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.033 qw(:Status); +use IO::Compress::Base::Common 2.035 qw(:Status); our ($VERSION); -$VERSION = '2.033'; +$VERSION = '2.035'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Base.pm b/cpan/IO-Compress/lib/IO/Compress/Base.pm index d0d585ce76..3bf46bd157 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Base.pm @@ -6,21 +6,21 @@ require 5.004 ; use strict ; use warnings; -use IO::Compress::Base::Common 2.033 ; +use IO::Compress::Base::Common 2.035 ; -use IO::File ; +use IO::File qw(SEEK_SET SEEK_END); ; use Scalar::Util qw(blessed readonly); #use File::Glob; #require Exporter ; -use Carp ; -use Symbol; +use Carp() ; +use Symbol(); use bytes; our (@ISA, $VERSION); @ISA = qw(Exporter IO::File); -$VERSION = '2.033'; +$VERSION = '2.035'; #Can't locate object method "SWASHNEW" via package "utf8" (perhaps you forgot to load "utf8"?) at .../ext/Compress-Zlib/Gzip/blib/lib/Compress/Zlib/Common.pm line 16. @@ -48,7 +48,7 @@ sub croakError { my $self = shift ; $self->saveErrorString(0, $_[0]); - croak $_[0]; + Carp::croak $_[0]; } sub closeError @@ -392,7 +392,7 @@ sub _def # finally the 1 to 1 and n to 1 return $obj->_singleTarget($x, 1, $input, $output, @_); - croak "should not be here" ; + Carp::croak "should not be here" ; } sub _singleTarget @@ -504,7 +504,7 @@ sub _wr2 return $count ; } - croak "Should not be here"; + Carp::croak "Should not be here"; return undef; } @@ -581,7 +581,7 @@ sub syswrite } $] >= 5.008 and ( utf8::downgrade($$buffer, 1) - or croak "Wide character in " . *$self->{ClassName} . "::write:"); + or Carp::croak "Wide character in " . *$self->{ClassName} . "::write:"); if (@_ > 1) { @@ -913,7 +913,7 @@ sub input_line_number sub _notAvailable { my $name = shift ; - return sub { croak "$name Not Available: File opened only for output" ; } ; + return sub { Carp::croak "$name Not Available: File opened only for output" ; } ; } *read = _notAvailable('read'); diff --git a/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm b/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm index 1b38c59846..61db06da8f 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm @@ -11,7 +11,7 @@ use File::GlobMapper; require Exporter; our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE); @ISA = qw(Exporter); -$VERSION = '2.033'; +$VERSION = '2.035'; @EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput isaFileGlobString cleanFileGlobString oneTarget diff --git a/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm b/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm index 5d478d91bd..67ba59f07c 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm @@ -5,16 +5,16 @@ use warnings; use bytes; require Exporter ; -use IO::Compress::Base 2.033 ; +use IO::Compress::Base 2.035 ; -use IO::Compress::Base::Common 2.033 qw(createSelfTiedObject); -use IO::Compress::Adapter::Bzip2 2.033 ; +use IO::Compress::Base::Common 2.035 qw(createSelfTiedObject); +use IO::Compress::Adapter::Bzip2 2.035 ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error); -$VERSION = '2.033'; +$VERSION = '2.035'; $Bzip2Error = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -51,7 +51,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.033 qw(:Parse); + use IO::Compress::Base::Common 2.035 qw(:Parse); return ( 'BlockSize100K' => [0, 1, Parse_unsigned, 1], diff --git a/cpan/IO-Compress/lib/IO/Compress/Deflate.pm b/cpan/IO-Compress/lib/IO/Compress/Deflate.pm index 20329bb428..d5a2ad0b0f 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Deflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Deflate.pm @@ -6,16 +6,16 @@ use bytes; require Exporter ; -use IO::Compress::RawDeflate 2.033 ; +use IO::Compress::RawDeflate 2.035 ; -use Compress::Raw::Zlib 2.033 ; -use IO::Compress::Zlib::Constants 2.033 ; -use IO::Compress::Base::Common 2.033 qw(createSelfTiedObject); +use Compress::Raw::Zlib 2.035 ; +use IO::Compress::Zlib::Constants 2.035 ; +use IO::Compress::Base::Common 2.035 qw(createSelfTiedObject); our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError); -$VERSION = '2.033'; +$VERSION = '2.035'; $DeflateError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -774,7 +774,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno> will return the underlying file descriptor. Once the C<close> method is called C<fileno> will return C<undef>. -If the C<$z> object is is associated with a buffer, this method will return +If the C<$z> object is associated with a buffer, this method will return C<undef>. =head2 close diff --git a/cpan/IO-Compress/lib/IO/Compress/Gzip.pm b/cpan/IO-Compress/lib/IO/Compress/Gzip.pm index 2a7894257d..c45c0764bf 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Gzip.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Gzip.pm @@ -8,12 +8,12 @@ use warnings; use bytes; -use IO::Compress::RawDeflate 2.033 ; +use IO::Compress::RawDeflate 2.035 ; -use Compress::Raw::Zlib 2.033 ; -use IO::Compress::Base::Common 2.033 qw(:Status :Parse createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.033 ; -use IO::Compress::Zlib::Extra 2.033 ; +use Compress::Raw::Zlib 2.035 ; +use IO::Compress::Base::Common 2.035 qw(:Status :Parse createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.035 ; +use IO::Compress::Zlib::Extra 2.035 ; BEGIN { @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError); -$VERSION = '2.033'; +$VERSION = '2.035'; $GzipError = '' ; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -1086,7 +1086,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno> will return the underlying file descriptor. Once the C<close> method is called C<fileno> will return C<undef>. -If the C<$z> object is is associated with a buffer, this method will return +If the C<$z> object is associated with a buffer, this method will return C<undef>. =head2 close diff --git a/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm index ca74d73883..3329f55915 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names); our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE); -$VERSION = '2.033'; +$VERSION = '2.035'; @ISA = qw(Exporter); diff --git a/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm b/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm index bb077f989c..0dda715338 100644 --- a/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm @@ -7,16 +7,16 @@ use warnings; use bytes; -use IO::Compress::Base 2.033 ; -use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject); -use IO::Compress::Adapter::Deflate 2.033 ; +use IO::Compress::Base 2.035 ; +use IO::Compress::Base::Common 2.035 qw(:Status createSelfTiedObject); +use IO::Compress::Adapter::Deflate 2.035 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); -$VERSION = '2.033'; +$VERSION = '2.035'; $RawDeflateError = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -142,8 +142,8 @@ sub getZlibParams { my $self = shift ; - use IO::Compress::Base::Common 2.033 qw(:Parse); - use Compress::Raw::Zlib 2.033 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.035 qw(:Parse); + use Compress::Raw::Zlib 2.035 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); return ( @@ -861,7 +861,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno> will return the underlying file descriptor. Once the C<close> method is called C<fileno> will return C<undef>. -If the C<$z> object is is associated with a buffer, this method will return +If the C<$z> object is associated with a buffer, this method will return C<undef>. =head2 close diff --git a/cpan/IO-Compress/lib/IO/Compress/Zip.pm b/cpan/IO-Compress/lib/IO/Compress/Zip.pm index 62acc8e1fa..f6fcf450f2 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zip.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zip.pm @@ -4,26 +4,26 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject); -use IO::Compress::RawDeflate 2.033 ; -use IO::Compress::Adapter::Deflate 2.033 ; -use IO::Compress::Adapter::Identity 2.033 ; -use IO::Compress::Zlib::Extra 2.033 ; -use IO::Compress::Zip::Constants 2.033 ; +use IO::Compress::Base::Common 2.035 qw(:Status createSelfTiedObject); +use IO::Compress::RawDeflate 2.035 ; +use IO::Compress::Adapter::Deflate 2.035 ; +use IO::Compress::Adapter::Identity 2.035 ; +use IO::Compress::Zlib::Extra 2.035 ; +use IO::Compress::Zip::Constants 2.035 ; -use Compress::Raw::Zlib 2.033 qw(crc32) ; +use Compress::Raw::Zlib 2.035 qw(crc32) ; BEGIN { eval { require IO::Compress::Adapter::Bzip2 ; - import IO::Compress::Adapter::Bzip2 2.033 ; + import IO::Compress::Adapter::Bzip2 2.035 ; require IO::Compress::Bzip2 ; - import IO::Compress::Bzip2 2.033 ; + import IO::Compress::Bzip2 2.035 ; } ; # eval { require IO::Compress::Adapter::Lzma ; # import IO::Compress::Adapter::Lzma 2.020 ; # require IO::Compress::Lzma ; -# import IO::Compress::Lzma 2.033 ; +# import IO::Compress::Lzma 2.035 ; # } ; } @@ -32,7 +32,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError); -$VERSION = '2.033'; +$VERSION = '2.035'; $ZipError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -513,8 +513,8 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.033 qw(:Parse); - use Compress::Raw::Zlib 2.033 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.035 qw(:Parse); + use Compress::Raw::Zlib 2.035 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); my @Bzip2 = (); @@ -1460,7 +1460,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno> will return the underlying file descriptor. Once the C<close> method is called C<fileno> will return C<undef>. -If the C<$z> object is is associated with a buffer, this method will return +If the C<$z> object is associated with a buffer, this method will return C<undef>. =head2 close diff --git a/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm index 44fd5e891d..e4600f545d 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm @@ -7,7 +7,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS); -$VERSION = '2.033'; +$VERSION = '2.035'; @ISA = qw(Exporter); diff --git a/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm index 4c2d5eb00f..a96992b92a 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT); -$VERSION = '2.033'; +$VERSION = '2.035'; @ISA = qw(Exporter); diff --git a/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm b/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm index 3b13e291cc..dda5d88c8f 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm @@ -8,9 +8,9 @@ use bytes; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = '2.033'; +$VERSION = '2.035'; -use IO::Compress::Gzip::Constants 2.033 ; +use IO::Compress::Gzip::Constants 2.035 ; sub ExtraFieldError { diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm index 6703e59285..4ed3a67895 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.033 qw(:Status); +use IO::Compress::Base::Common 2.035 qw(:Status); -use Compress::Raw::Bzip2 2.033 ; +use Compress::Raw::Bzip2 2.035 ; our ($VERSION, @ISA); -$VERSION = '2.033'; +$VERSION = '2.035'; sub mkUncompObject { diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm index 0705a1c9d2..879a7f61af 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm @@ -4,13 +4,13 @@ use warnings; use strict; use bytes; -use IO::Compress::Base::Common 2.033 qw(:Status); +use IO::Compress::Base::Common 2.035 qw(:Status); our ($VERSION); -$VERSION = '2.033'; +$VERSION = '2.035'; -use Compress::Raw::Zlib 2.033 (); +use Compress::Raw::Zlib 2.035 (); sub mkUncompObject { diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm index dc0365ce00..25d70e142d 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm @@ -4,11 +4,11 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.033 qw(:Status); -use Compress::Raw::Zlib 2.033 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); +use IO::Compress::Base::Common 2.035 qw(:Status); +use Compress::Raw::Zlib 2.035 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); our ($VERSION); -$VERSION = '2.033'; +$VERSION = '2.035'; diff --git a/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm index 796230ec92..3b6dc38fc3 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm @@ -6,22 +6,22 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.033 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.035 qw(createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.033 (); +use IO::Uncompress::Adapter::Inflate 2.035 (); -use IO::Uncompress::Base 2.033 ; -use IO::Uncompress::Gunzip 2.033 ; -use IO::Uncompress::Inflate 2.033 ; -use IO::Uncompress::RawInflate 2.033 ; -use IO::Uncompress::Unzip 2.033 ; +use IO::Uncompress::Base 2.035 ; +use IO::Uncompress::Gunzip 2.035 ; +use IO::Uncompress::Inflate 2.035 ; +use IO::Uncompress::RawInflate 2.035 ; +use IO::Uncompress::Unzip 2.035 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError); -$VERSION = '2.033'; +$VERSION = '2.035'; $AnyInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -48,7 +48,7 @@ sub anyinflate sub getExtraParams { - use IO::Compress::Base::Common 2.033 qw(:Parse); + use IO::Compress::Base::Common 2.035 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ; } @@ -856,7 +856,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno> will return the underlying file descriptor. Once the C<close> method is called C<fileno> will return C<undef>. -If the C<$z> object is is associated with a buffer, this method will return +If the C<$z> object is associated with a buffer, this method will return C<undef>. =head2 close diff --git a/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm b/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm index 64d2fa001a..08c122f2c4 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm @@ -4,16 +4,16 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.033 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.035 qw(createSelfTiedObject); -use IO::Uncompress::Base 2.033 ; +use IO::Uncompress::Base 2.035 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError); -$VERSION = '2.033'; +$VERSION = '2.035'; $AnyUncompressError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -27,22 +27,22 @@ Exporter::export_ok_tags('all'); BEGIN { - eval ' use IO::Uncompress::Adapter::Inflate 2.033 ;'; - eval ' use IO::Uncompress::Adapter::Bunzip2 2.033 ;'; - eval ' use IO::Uncompress::Adapter::LZO 2.033 ;'; - eval ' use IO::Uncompress::Adapter::Lzf 2.033 ;'; + eval ' use IO::Uncompress::Adapter::Inflate 2.035 ;'; + eval ' use IO::Uncompress::Adapter::Bunzip2 2.035 ;'; + eval ' use IO::Uncompress::Adapter::LZO 2.035 ;'; + eval ' use IO::Uncompress::Adapter::Lzf 2.035 ;'; eval ' use IO::Uncompress::Adapter::UnLzma 2.020 ;'; eval ' use IO::Uncompress::Adapter::UnXz 2.020 ;'; - eval ' use IO::Uncompress::Bunzip2 2.033 ;'; - eval ' use IO::Uncompress::UnLzop 2.033 ;'; - eval ' use IO::Uncompress::Gunzip 2.033 ;'; - eval ' use IO::Uncompress::Inflate 2.033 ;'; - eval ' use IO::Uncompress::RawInflate 2.033 ;'; - eval ' use IO::Uncompress::Unzip 2.033 ;'; - eval ' use IO::Uncompress::UnLzf 2.033 ;'; - eval ' use IO::Uncompress::UnLzma 2.033 ;'; - eval ' use IO::Uncompress::UnXz 2.033 ;'; + eval ' use IO::Uncompress::Bunzip2 2.035 ;'; + eval ' use IO::Uncompress::UnLzop 2.035 ;'; + eval ' use IO::Uncompress::Gunzip 2.035 ;'; + eval ' use IO::Uncompress::Inflate 2.035 ;'; + eval ' use IO::Uncompress::RawInflate 2.035 ;'; + eval ' use IO::Uncompress::Unzip 2.035 ;'; + eval ' use IO::Uncompress::UnLzf 2.035 ;'; + eval ' use IO::Uncompress::UnLzma 2.035 ;'; + eval ' use IO::Uncompress::UnXz 2.035 ;'; } sub new @@ -60,7 +60,7 @@ sub anyuncompress sub getExtraParams { - use IO::Compress::Base::Common 2.033 qw(:Parse); + use IO::Compress::Base::Common 2.035 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] , 'UnLzma' => [1, 1, Parse_boolean, 0] ) ; } @@ -904,7 +904,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno> will return the underlying file descriptor. Once the C<close> method is called C<fileno> will return C<undef>. -If the C<$z> object is is associated with a buffer, this method will return +If the C<$z> object is associated with a buffer, this method will return C<undef>. =head2 close diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Base.pm b/cpan/IO-Compress/lib/IO/Uncompress/Base.pm index 77e4a8c581..f432b0e2c6 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Base.pm @@ -9,13 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter IO::File); -$VERSION = '2.033'; +$VERSION = '2.035'; use constant G_EOF => 0 ; use constant G_ERR => -1 ; -use IO::Compress::Base::Common 2.033 ; -#use Parse::Parameters ; +use IO::Compress::Base::Common 2.035 ; use IO::File ; use Symbol; @@ -25,16 +24,12 @@ use Carp ; %EXPORT_TAGS = ( ); push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; -#Exporter::export_ok_tags('all') ; - - sub smartRead { my $self = $_[0]; my $out = $_[1]; my $size = $_[2]; - #$$out = "" ; $$out = "" ; my $offset = 0 ; @@ -48,7 +43,6 @@ sub smartRead } if ( length *$self->{Prime} ) { - #$$out = substr(*$self->{Prime}, 0, $size, '') ; $$out = substr(*$self->{Prime}, 0, $size) ; substr(*$self->{Prime}, 0, $size) = '' ; if (length $$out == $size) { @@ -86,7 +80,6 @@ sub smartRead } if (length $$out > $size ) { - #*$self->{Prime} = substr($$out, $size, length($$out), ''); *$self->{Prime} = substr($$out, $size, length($$out)); substr($$out, $size, length($$out)) = ''; } @@ -97,7 +90,6 @@ sub smartRead no warnings 'uninitialized'; my $buf = *$self->{Buffer} ; $$buf = '' unless defined $$buf ; - #$$out = '' unless defined $$out ; substr($$out, $offset) = substr($$buf, *$self->{BufferOffset}, $get_size); if (*$self->{ConsumeInput}) { substr($$buf, 0, $get_size) = '' } @@ -148,7 +140,6 @@ sub smartSeek my $self = shift ; my $offset = shift ; my $truncate = shift; - #print "smartSeek to $offset\n"; # TODO -- need to take prime into account if (defined *$self->{FH}) @@ -207,7 +198,7 @@ sub smartEof my $status = $self->smartRead(\$buffer, 1); $self->pushBack($buffer) if length $buffer; $self->setErrInfo($info); - + return $status == 0 ; } elsif (defined *$self->{InputEvent}) @@ -244,8 +235,6 @@ sub saveStatus { my $self = shift ; my $errno = shift() + 0 ; - #return $errno unless $errno || ! defined *$self->{ErrorNo}; - #return $errno unless $errno ; *$self->{ErrorNo} = $errno; ${ *$self->{Error} } = '' ; @@ -259,12 +248,9 @@ sub saveErrorString my $self = shift ; my $retval = shift ; - #return $retval if ${ *$self->{Error} }; - ${ *$self->{Error} } = shift ; - *$self->{ErrorNo} = shift() + 0 if @_ ; + *$self->{ErrorNo} = @_ ? shift() + 0 : STATUS_ERROR ; - #warn "saveErrorString: " . ${ *$self->{Error} } . " " . *$self->{Error} . "\n" ; return $retval; } @@ -482,14 +468,32 @@ sub _create return undef unless defined $status; - if ( ! $status) { + *$obj->{InNew} = 0; + *$obj->{Closed} = 0; + + if ($status) { + # Need to try uncompressing to catch the case + # where the compressed file uncompresses to an + # empty string - so eof is set immediately. + + my $out_buffer = ''; + + $status = $obj->read(\$out_buffer); + + if ($status < 0) { + *$obj->{ReadStatus} = [ $status, $obj->error(), $obj->errorNo() ]; + } + + $obj->ungetc($out_buffer) + if length $out_buffer; + } + else { return undef unless *$obj->{Transparent}; $obj->clearError(); *$obj->{Type} = 'plain'; *$obj->{Plain} = 1; - #$status = $obj->mkIdentityUncomp($class, $got); $obj->pushBack(*$obj->{HeaderPending}) ; } @@ -725,7 +729,6 @@ sub _rd2 } last if $status < 0 || $z->smartEof(); - #last if $status < 0 ; last unless *$self->{MultiStream}; @@ -784,7 +787,7 @@ sub readBlock } my $status = $self->smartRead($buff, $size) ; - return $self->saveErrorString(STATUS_ERROR, "Error Reading Data: $!") + return $self->saveErrorString(STATUS_ERROR, "Error Reading Data: $!", $!) if $status == STATUS_ERROR ; if ($status == 0 ) { @@ -811,7 +814,6 @@ sub _raw_read my $self = shift ; return G_EOF if *$self->{Closed} ; - #return G_EOF if !length *$self->{Pending} && *$self->{EndStream} ; return G_EOF if *$self->{EndStream} ; my $buffer = shift ; @@ -851,6 +853,7 @@ sub _raw_read my $temp_buf = ''; my $outSize = 0; my $status = $self->readBlock(\$temp_buf, *$self->{BlockSize}, $outSize) ; + return G_ERR if $status == STATUS_ERROR ; @@ -889,8 +892,6 @@ sub _raw_read if ($status == STATUS_ENDSTREAM) { *$self->{EndStream} = 1 ; -#$self->pushBack($temp_buf) ; -#$temp_buf = ''; my $trailer; my $trailer_size = *$self->{Info}{TrailerLength} ; @@ -985,7 +986,6 @@ sub gotoNextStream *$self->{CompSize}->reset(); my $magic = $self->ckMagic(); - #*$self->{EndStream} = 0 ; if ( ! defined $magic) { if (! *$self->{Transparent} || $self->eof()) @@ -1030,6 +1030,13 @@ sub read my $self = shift ; + if (defined *$self->{ReadStatus} ) { + my $status = *$self->{ReadStatus}[0]; + $self->saveErrorString( @{ *$self->{ReadStatus} } ); + delete *$self->{ReadStatus} ; + return $status ; + } + return G_EOF if *$self->{Closed} ; my $buffer ; @@ -1065,6 +1072,9 @@ sub read } } } + elsif (! defined $$buffer) { + $$buffer = '' ; + } return G_EOF if !length *$self->{Pending} && *$self->{EndStream} ; @@ -1121,7 +1131,6 @@ sub read *$self->{Pending} = $out_buffer; $out_buffer = \*$self->{Pending} ; - #substr($$buffer, $offset) = substr($$out_buffer, 0, $length, '') ; substr($$buffer, $offset) = substr($$out_buffer, 0, $length) ; substr($$out_buffer, 0, $length) = '' ; @@ -1137,7 +1146,7 @@ sub _getline if ( ! defined $/ ) { my $data ; 1 while ($status = $self->read($data)) > 0 ; - return $status < 0 ? \undef : \$data ; + return ($status, \$data); } # Record Mode @@ -1145,7 +1154,7 @@ sub _getline my $reclen = ${$/} ; my $data ; $status = $self->read($data, $reclen) ; - return $status < 0 ? \undef : \$data ; + return ($status, \$data); } # Paragraph Mode @@ -1155,47 +1164,54 @@ sub _getline if ($paragraph =~ s/^(.*?\n\n+)//s) { *$self->{Pending} = $paragraph ; my $par = $1 ; - return \$par ; + return (1, \$par); } } - return $status < 0 ? \undef : \$paragraph; + return ($status, \$paragraph); } # $/ isn't empty, or a reference, so it's Line Mode. { my $line ; - my $offset; my $p = \*$self->{Pending} ; - - if (length(*$self->{Pending}) && - ($offset = index(*$self->{Pending}, $/)) >=0) { - my $l = substr(*$self->{Pending}, 0, $offset + length $/ ); - substr(*$self->{Pending}, 0, $offset + length $/) = ''; - return \$l; - } - while (($status = $self->read($line)) > 0 ) { my $offset = index($line, $/); if ($offset >= 0) { my $l = substr($line, 0, $offset + length $/ ); substr($line, 0, $offset + length $/) = ''; $$p = $line; - return \$l; + return (1, \$l); } } - return $status < 0 ? \undef : \$line; + return ($status, \$line); } } sub getline { my $self = shift; + + if (defined *$self->{ReadStatus} ) { + $self->saveErrorString( @{ *$self->{ReadStatus} } ); + delete *$self->{ReadStatus} ; + return undef; + } + + return undef + if *$self->{Closed} || (!length *$self->{Pending} && *$self->{EndStream}) ; + my $current_append = *$self->{AppendOutput} ; *$self->{AppendOutput} = 1; - my $lineref = $self->_getline(); - $. = ++ *$self->{LineNo} if defined $$lineref ; + + my ($status, $lineref) = $self->_getline(); *$self->{AppendOutput} = $current_append; + + return undef + if $status < 0 || length $$lineref == 0 ; + + $. = ++ *$self->{LineNo} ; + return $$lineref ; } @@ -1289,7 +1305,6 @@ sub close if (defined *$self->{FH}) { if ((! *$self->{Handle} || *$self->{AutoClose}) && ! *$self->{StdIO}) { - #if ( *$self->{AutoClose}) { local $.; $! = 0 ; $status = *$self->{FH}->close(); @@ -1420,7 +1435,6 @@ sub input_line_number sub _notAvailable { my $name = shift ; - #return sub { croak "$name Not Available" ; } ; return sub { croak "$name Not Available: File opened only for intput" ; } ; } diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm b/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm index 39adbef079..38a4fc8970 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm @@ -4,15 +4,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject); +use IO::Compress::Base::Common 2.035 qw(:Status createSelfTiedObject); -use IO::Uncompress::Base 2.033 ; -use IO::Uncompress::Adapter::Bunzip2 2.033 ; +use IO::Uncompress::Base 2.035 ; +use IO::Uncompress::Adapter::Bunzip2 2.035 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error); -$VERSION = '2.033'; +$VERSION = '2.035'; $Bunzip2Error = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -40,7 +40,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.033 qw(:Parse); + use IO::Compress::Base::Common 2.035 qw(:Parse); return ( 'Verbosity' => [1, 1, Parse_boolean, 0], diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm b/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm index 94fd6756d9..ecd3bc496e 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm @@ -9,12 +9,12 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.033 ; +use IO::Uncompress::RawInflate 2.035 ; -use Compress::Raw::Zlib 2.033 qw( crc32 ) ; -use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.033 ; -use IO::Compress::Zlib::Extra 2.033 ; +use Compress::Raw::Zlib 2.035 qw( crc32 ) ; +use IO::Compress::Base::Common 2.035 qw(:Status createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.035 ; +use IO::Compress::Zlib::Extra 2.035 ; require Exporter ; @@ -28,7 +28,7 @@ Exporter::export_ok_tags('all'); $GunzipError = ''; -$VERSION = '2.033'; +$VERSION = '2.035'; sub new { @@ -47,7 +47,7 @@ sub gunzip sub getExtraParams { - use IO::Compress::Base::Common 2.033 qw(:Parse); + use IO::Compress::Base::Common 2.035 qw(:Parse); return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ; } @@ -980,7 +980,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno> will return the underlying file descriptor. Once the C<close> method is called C<fileno> will return C<undef>. -If the C<$z> object is is associated with a buffer, this method will return +If the C<$z> object is associated with a buffer, this method will return C<undef>. =head2 close diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm index a7b12fcde4..ae920d3a1f 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm @@ -5,15 +5,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject); -use IO::Compress::Zlib::Constants 2.033 ; +use IO::Compress::Base::Common 2.035 qw(:Status createSelfTiedObject); +use IO::Compress::Zlib::Constants 2.035 ; -use IO::Uncompress::RawInflate 2.033 ; +use IO::Uncompress::RawInflate 2.035 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError); -$VERSION = '2.033'; +$VERSION = '2.035'; $InflateError = ''; @ISA = qw( Exporter IO::Uncompress::RawInflate ); @@ -851,7 +851,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno> will return the underlying file descriptor. Once the C<close> method is called C<fileno> will return C<undef>. -If the C<$z> object is is associated with a buffer, this method will return +If the C<$z> object is associated with a buffer, this method will return C<undef>. =head2 close diff --git a/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm index 07d70e316c..de109fb0cd 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm @@ -5,16 +5,16 @@ use strict ; use warnings; use bytes; -use Compress::Raw::Zlib 2.033 ; -use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject); +use Compress::Raw::Zlib 2.035 ; +use IO::Compress::Base::Common 2.035 qw(:Status createSelfTiedObject); -use IO::Uncompress::Base 2.033 ; -use IO::Uncompress::Adapter::Inflate 2.033 ; +use IO::Uncompress::Base 2.035 ; +use IO::Uncompress::Adapter::Inflate 2.035 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError); -$VERSION = '2.033'; +$VERSION = '2.035'; $RawInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -979,7 +979,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno> will return the underlying file descriptor. Once the C<close> method is called C<fileno> will return C<undef>. -If the C<$z> object is is associated with a buffer, this method will return +If the C<$z> object is associated with a buffer, this method will return C<undef>. =head2 close diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm b/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm index a678251a89..5faeb3bf58 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm @@ -8,14 +8,14 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.033 ; -use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.033 ; -use IO::Uncompress::Adapter::Identity 2.033 ; -use IO::Compress::Zlib::Extra 2.033 ; -use IO::Compress::Zip::Constants 2.033 ; +use IO::Uncompress::RawInflate 2.035 ; +use IO::Compress::Base::Common 2.035 qw(:Status createSelfTiedObject); +use IO::Uncompress::Adapter::Inflate 2.035 ; +use IO::Uncompress::Adapter::Identity 2.035 ; +use IO::Compress::Zlib::Extra 2.035 ; +use IO::Compress::Zip::Constants 2.035 ; -use Compress::Raw::Zlib 2.033 qw(crc32) ; +use Compress::Raw::Zlib 2.035 qw(crc32) ; BEGIN { @@ -30,7 +30,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup); -$VERSION = '2.033'; +$VERSION = '2.035'; $UnzipError = ''; @ISA = qw(Exporter IO::Uncompress::RawInflate); @@ -63,7 +63,7 @@ sub unzip sub getExtraParams { - use IO::Compress::Base::Common 2.033 qw(:Parse); + use IO::Compress::Base::Common 2.035 qw(:Parse); return ( @@ -1425,7 +1425,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno> will return the underlying file descriptor. Once the C<close> method is called C<fileno> will return C<undef>. -If the C<$z> object is is associated with a buffer, this method will return +If the C<$z> object is associated with a buffer, this method will return C<undef>. =head2 close diff --git a/cpan/IO-Compress/t/000prereq.t b/cpan/IO-Compress/t/000prereq.t index e160228e68..cc920a09c5 100644 --- a/cpan/IO-Compress/t/000prereq.t +++ b/cpan/IO-Compress/t/000prereq.t @@ -25,7 +25,7 @@ BEGIN if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - my $VERSION = '2.033'; + my $VERSION = '2.035'; my @NAMES = qw( Compress::Raw::Bzip2 Compress::Raw::Zlib diff --git a/cpan/IO-Compress/t/004gziphdr.t b/cpan/IO-Compress/t/004gziphdr.t index 0583fa97cd..2ef9459785 100644 --- a/cpan/IO-Compress/t/004gziphdr.t +++ b/cpan/IO-Compress/t/004gziphdr.t @@ -20,7 +20,7 @@ BEGIN { if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 910 + $extra ; + plan tests => 915 + $extra ; use_ok('Compress::Raw::Zlib') ; use_ok('IO::Compress::Gzip::Constants') ; @@ -479,23 +479,25 @@ for my $value ( "0D", "0A", "0A0D", "0D0A", "0A0A", "0D0D") } { - # Check Minimal + no compressed data + title "Check Minimal + no compressed data"; # This is the smallest possible gzip file (20 bytes) ok my $x = new IO::Compress::Gzip $name, -Minimal => 1; - ok $x->close ; - #ok GZreadFile($name) eq '' ; + isa_ok $x, "IO::Compress::Gzip"; + ok $x->close, "closed" ; - ok $x = new IO::Uncompress::Gunzip $name, -Append => 1 ; + ok $x = new IO::Uncompress::Gunzip $name, -Append => 0 ; + isa_ok $x, "IO::Uncompress::Gunzip"; my $data ; my $status = 1; + ok $x->eof(), "eof" ; $status = $x->read($data) while $status > 0; - is $status, 0 ; - is $data, ''; - ok ! $x->error() ; - ok $x->eof() ; + is $status, 0, "status == 0" ; + is $data, '', "empty string"; + ok ! $x->error(), "no error" ; + ok $x->eof(), "eof" ; my $hdr = $x->getHeaderInfo(); ok $hdr; @@ -519,7 +521,7 @@ for my $value ( "0D", "0A", "0A0D", "0D0A", "0A0A", "0D0D") } { - # Header Corruption Tests + title "Header Corruption Tests"; my $string = <<EOM; some text @@ -584,8 +586,10 @@ EOM title "ExtraField max raw size"; my $x ; my $store = "x" x GZIP_FEXTRA_MAX_SIZE ; - my $z = new IO::Compress::Gzip(\$x, ExtraField => $store, Strict => 0) ; - ok $z, "Created IO::Compress::Gzip object" ; + { + my $z = new IO::Compress::Gzip(\$x, ExtraField => $store, Strict => 0) ; + ok $z, "Created IO::Compress::Gzip object" ; + } my $gunz = new IO::Uncompress::Gunzip \$x, Strict => 0; ok $gunz, "Created IO::Uncompress::Gunzip object" ; my $hdr = $gunz->getHeaderInfo(); @@ -812,6 +816,7 @@ EOM my $string = <<EOM; some text EOM + $string = $string x 1000; my $good ; { @@ -843,19 +848,21 @@ EOM foreach my $strict (0, 1) { - ok my $gunz = new IO::Uncompress::Gunzip $name, -Strict => $strict ; + ok my $gunz = new IO::Uncompress::Gunzip $name, Append => 1, -Strict => $strict ; my $uncomp ; + my $status = 1; + $status = $gunz->read($uncomp) while $status > 0; if ($strict) { - ok $gunz->read($uncomp) < 0 ; + cmp_ok $status, '<', 0 ; like $GunzipError, "/Trailer Error: trailer truncated. Expected 8 bytes, got $got/"; } else { - ok $gunz->read($uncomp) > 0 ; - ok ! $GunzipError ; + is $status, 0, "status 0"; + ok ! $GunzipError, "no error" ; my $expected = substr($buffer, - $got); - is $gunz->trailingData(), $expected_trailing; + is $gunz->trailingData(), $expected_trailing, "trailing data"; } ok $gunz->eof() ; ok $uncomp eq $string; @@ -874,17 +881,20 @@ EOM foreach my $strict (0, 1) { ok my $gunz = new IO::Uncompress::Gunzip $name, + Append => 1, -Strict => $strict ; my $uncomp ; + my $status = 1; + $status = $gunz->read($uncomp) while $status > 0; if ($strict) { - ok $gunz->read($uncomp) < 0 ; + cmp_ok $status, '<', 0 ; my $got_len = $actual_len + 1; like $GunzipError, "/Trailer Error: ISIZE mismatch. Got $got_len, expected $actual_len/"; } else { - ok $gunz->read($uncomp) > 0 ; + is $status, 0; ok ! $GunzipError ; #is $gunz->trailingData(), substr($buffer, - $got) ; } @@ -906,16 +916,19 @@ EOM foreach my $strict (0, 1) { ok my $gunz = new IO::Uncompress::Gunzip $name, + -Append => 1, -Strict => $strict ; my $uncomp ; + my $status = 1; + $status = $gunz->read($uncomp) while $status > 0; if ($strict) { - ok $gunz->read($uncomp) < 0 ; + cmp_ok $status, '<', 0 ; like $GunzipError, '/Trailer Error: CRC mismatch/'; } else { - ok $gunz->read($uncomp) > 0 ; + is $status, 0; ok ! $GunzipError ; } ok ! $gunz->trailingData() ; @@ -938,16 +951,19 @@ EOM foreach my $strict (0, 1) { ok my $gunz = new IO::Uncompress::Gunzip $name, + -Append => 1, -Strict => $strict ; my $uncomp ; + my $status = 1; + $status = $gunz->read($uncomp) while $status > 0; if ($strict) { - ok $gunz->read($uncomp) < 0 ; + cmp_ok $status, '<', 0 ; like $GunzipError, '/Trailer Error: CRC mismatch/'; } else { - ok $gunz->read($uncomp) > 0 ; + is $status, 0; ok ! $GunzipError ; } ok $gunz->eof() ; diff --git a/cpan/IO-Compress/t/005defhdr.t b/cpan/IO-Compress/t/005defhdr.t index 990b79b3f1..28059ce2d1 100644 --- a/cpan/IO-Compress/t/005defhdr.t +++ b/cpan/IO-Compress/t/005defhdr.t @@ -38,12 +38,12 @@ sub ReadHeaderInfo my $buffer ; ok my $def = new IO::Compress::Deflate \$buffer, %opts ; - is $def->write($string), length($string) ; - ok $def->close ; + is $def->write($string), length($string), "write" ; + ok $def->close, "closed" ; #print "ReadHeaderInfo\n"; hexDump(\$buffer); ok my $inf = new IO::Uncompress::Inflate \$buffer, Append => 1 ; - my $uncomp ; + my $uncomp = ""; #ok $inf->read($uncomp) ; my $actual = 0 ; my $status = 1 ; @@ -53,8 +53,8 @@ sub ReadHeaderInfo is $actual, length($string) ; is $uncomp, $string; - ok ! $inf->error() ; - ok $inf->eof() ; + ok ! $inf->error(), "! error" ; + ok $inf->eof(), "eof" ; ok my $hdr = $inf->getHeaderInfo(); ok $inf->close ; @@ -107,7 +107,7 @@ sub printHeaderInfo # Check the Deflate Header Parameters #======================================== -my $lex = new LexFile my $name ; +#my $lex = new LexFile my $name ; { title "Check default header settings" ; @@ -275,6 +275,7 @@ EOM some text EOM + $string = $string x 1000; my $good ; ok my $x = new IO::Compress::Deflate \$good ; ok $x->write($string) ; @@ -286,6 +287,7 @@ EOM foreach my $s (0, 1) { title "Trailer Corruption - Trailer truncated to $got bytes, strict $s" ; + my $lex = new LexFile my $name ; my $buffer = $good ; my $expected_trailing = substr($good, -4, 4) ; substr($expected_trailing, $trim) = ''; @@ -293,17 +295,20 @@ EOM substr($buffer, $trim) = ''; writeFile($name, $buffer) ; - ok my $gunz = new IO::Uncompress::Inflate $name, Strict => $s; + ok my $gunz = new IO::Uncompress::Inflate $name, Append => 1, Strict => $s; my $uncomp ; if ($s) { - ok $gunz->read($uncomp) < 0 ; + my $status ; + 1 while ($status = $gunz->read($uncomp)) > 0; + cmp_ok $status, "<", 0 ; like $IO::Uncompress::Inflate::InflateError,"/Trailer Error: trailer truncated. Expected 4 bytes, got $got/", "Trailer Error"; } else { - is $gunz->read($uncomp), length $string ; + 1 while $gunz->read($uncomp) > 0; + is $uncomp, $string ; } ok $gunz->eof() ; ok $uncomp eq $string; @@ -317,11 +322,14 @@ EOM my $buffer = $good ; my $crc = unpack("N", substr($buffer, -4, 4)); substr($buffer, -4, 4) = pack('N', $crc+1); + my $lex = new LexFile my $name ; writeFile($name, $buffer) ; - ok my $gunz = new IO::Uncompress::Inflate $name, Strict => 1; + ok my $gunz = new IO::Uncompress::Inflate $name, Append => 1, Strict => 1; my $uncomp ; - ok $gunz->read($uncomp) < 0 ; + my $status ; + 1 while ($status = $gunz->read($uncomp)) > 0; + cmp_ok $status, "<", 0 ; like $IO::Uncompress::Inflate::InflateError,'/Trailer Error: CRC mismatch/', "Trailer Error: CRC mismatch"; ok $gunz->eof() ; @@ -335,11 +343,14 @@ EOM my $buffer = $good ; my $crc = unpack("N", substr($buffer, -4, 4)); substr($buffer, -4, 4) = pack('N', $crc+1); + my $lex = new LexFile my $name ; writeFile($name, $buffer) ; - ok my $gunz = new IO::Uncompress::Inflate $name, Strict => 0; + ok my $gunz = new IO::Uncompress::Inflate $name, Append => 1, Strict => 0; my $uncomp ; - ok $gunz->read($uncomp) >= 0 ; + my $status ; + 1 while ($status = $gunz->read($uncomp)) > 0; + cmp_ok $status, '>=', 0 ; ok $gunz->eof() ; ok ! $gunz->trailingData() ; ok $uncomp eq $string; diff --git a/cpan/IO-Compress/t/010examples-bzip2.t b/cpan/IO-Compress/t/010examples-bzip2.t index 9bb5eb20e7..2248535f7d 100644 --- a/cpan/IO-Compress/t/010examples-bzip2.t +++ b/cpan/IO-Compress/t/010examples-bzip2.t @@ -66,12 +66,8 @@ EOM my @hello2 = grep(s/$/\n/, split(/\n/, $hello2)) ; -my $file1 = "hello1.gz" ; -my $file2 = "hello2.gz" ; -my $stderr = "err.out" ; - -for ($file1, $file2, $stderr) { 1 while unlink $_ } ; - +my ($file1, $file2, $stderr) ; +my $lex = new LexFile $file1, $file2, $stderr ; bzip2 \$hello1 => $file1 ; bzip2 \$hello2 => $file2 ; @@ -81,8 +77,7 @@ sub check my $command = shift ; my $expected = shift ; - my $stderr = 'err.out'; - 1 while unlink $stderr; + my $lex = new LexFile my $stderr ; my $cmd = "$command 2>$stderr"; my $stdout = `$cmd` ; @@ -137,9 +132,3 @@ for ($file1, $file2, $stderr) { 1 while unlink $_ } ; title "bzcat" ; check "$Perl ${examples}/bzcat $file2", $hello1 ; } - -END -{ - for ($file1, $file2, $stderr) { 1 while unlink $_ } ; -} - diff --git a/cpan/IO-Compress/t/010examples-zlib.t b/cpan/IO-Compress/t/010examples-zlib.t index 712c0b4934..70e7141088 100644 --- a/cpan/IO-Compress/t/010examples-zlib.t +++ b/cpan/IO-Compress/t/010examples-zlib.t @@ -66,12 +66,8 @@ EOM my @hello2 = grep(s/$/\n/, split(/\n/, $hello2)) ; -my $file1 = "hello1.gz" ; -my $file2 = "hello2.gz" ; -my $stderr = "err.out" ; - -for ($file1, $file2, $stderr) { 1 while unlink $_ } ; - +my ($file1, $file2, $stderr) ; +my $lex = new LexFile $file1, $file2, $stderr ; gzip \$hello1 => $file1 ; gzip \$hello2 => $file2 ; @@ -81,8 +77,8 @@ sub check my $command = shift ; my $expected = shift ; - my $stderr = 'err.out'; - 1 while unlink $stderr; + my $lex = new LexFile my $stderr ; + my $cmd = "$command 2>$stderr"; my $stdout = `$cmd` ; @@ -137,9 +133,3 @@ for ($file1, $file2, $stderr) { 1 while unlink $_ } ; title "gzcat" ; check "$Perl ${examples}/gzcat $file2", $hello1 ; } - -END -{ - for ($file1, $file2, $stderr) { 1 while unlink $_ } ; -} - diff --git a/cpan/IO-Compress/t/101truncate-bzip2.t b/cpan/IO-Compress/t/101truncate-bzip2.t index 795db751c5..6c1f0fb6ea 100644 --- a/cpan/IO-Compress/t/101truncate-bzip2.t +++ b/cpan/IO-Compress/t/101truncate-bzip2.t @@ -17,7 +17,7 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 3308 + $extra; + plan tests => 4012 + $extra; }; diff --git a/cpan/IO-Compress/t/101truncate-deflate.t b/cpan/IO-Compress/t/101truncate-deflate.t index 9928bf3f32..72e9b6418f 100644 --- a/cpan/IO-Compress/t/101truncate-deflate.t +++ b/cpan/IO-Compress/t/101truncate-deflate.t @@ -17,7 +17,7 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 2552 + $extra; + plan tests => 3056 + $extra; }; diff --git a/cpan/IO-Compress/t/101truncate-gzip.t b/cpan/IO-Compress/t/101truncate-gzip.t index 72b2fdd50e..1a9e7de335 100644 --- a/cpan/IO-Compress/t/101truncate-gzip.t +++ b/cpan/IO-Compress/t/101truncate-gzip.t @@ -18,7 +18,7 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 3040 + $extra; + plan tests => 3544 + $extra; }; diff --git a/cpan/IO-Compress/t/101truncate-zip.t b/cpan/IO-Compress/t/101truncate-zip.t index 56285dea4e..e0f54bf965 100644 --- a/cpan/IO-Compress/t/101truncate-zip.t +++ b/cpan/IO-Compress/t/101truncate-zip.t @@ -18,7 +18,7 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 7732 + $extra; + plan tests => 9156 + $extra; }; diff --git a/cpan/IO-Compress/t/compress/CompTestUtils.pm b/cpan/IO-Compress/t/compress/CompTestUtils.pm index f21045d259..644a61876f 100644 --- a/cpan/IO-Compress/t/compress/CompTestUtils.pm +++ b/cpan/IO-Compress/t/compress/CompTestUtils.pm @@ -25,6 +25,14 @@ sub like_eval like $@, @_ ; } +BEGIN { + eval { + require File::Temp; + } ; + +} + + { package LexFile ; @@ -36,8 +44,9 @@ sub like_eval my $self = shift ; foreach (@_) { - # autogenerate the name unless if none supplied - $_ = "tst" . $index ++ . ".tmp" + Carp::croak "NO!!!!" if defined $_; + # autogenerate the name if none supplied + $_ = "tst" . $$ . "X" . $index ++ . ".tmp" unless defined $_; } chmod 0777, @_; @@ -58,19 +67,58 @@ sub like_eval package LexDir ; use File::Path; + + our ($index); + $index = '00000'; + our ($useTempFile) = defined &File::Temp::tempdir; + our ($useTempDir) = defined &File::Temp::newdir; + sub new { my $self = shift ; - foreach (@_) { rmtree $_ } - bless [ @_ ], $self ; + + if ( $useTempDir) + { + foreach (@_) + { + Carp::croak "NO!!!!" if defined $_; + $_ = File::Temp->newdir(DIR => '.'); + } + bless [ @_ ], $self ; + } + elsif ( $useTempFile) + { + foreach (@_) + { + Carp::croak "NO!!!!" if defined $_; + $_ = File::Temp::tempdir(DIR => '.', CLEANUP => 1); + } + bless [ @_ ], $self ; + } + else + { + foreach (@_) + { + Carp::croak "NO!!!!" if defined $_; + # autogenerate the name if none supplied + $_ = "tmpdir" . $$ . "X" . $index ++ . ".tmp" ; + } + foreach (@_) { rmtree $_; mkdir $_, 0777 } + bless [ @_ ], $self ; + } + } sub DESTROY { - my $self = shift ; - foreach (@$self) { rmtree $_ } + if (! $useTempFile) + { + my $self = shift ; + foreach (@$self) { rmtree $_ } + } } } + sub readFile { my $f = shift ; diff --git a/cpan/IO-Compress/t/compress/generic.pl b/cpan/IO-Compress/t/compress/generic.pl index 8bda69d87a..35056b155a 100644 --- a/cpan/IO-Compress/t/compress/generic.pl +++ b/cpan/IO-Compress/t/compress/generic.pl @@ -4,9 +4,9 @@ use warnings; use bytes; use Test::More ; -use CompTestUtils; use IO::Handle qw(SEEK_SET SEEK_CUR SEEK_END); +use CompTestUtils; our ($UncompressClass); BEGIN @@ -18,7 +18,7 @@ BEGIN $extra = 1 if $st ; - plan(tests => 666 + $extra) ; + plan(tests => 794 + $extra) ; } sub myGZreadFile @@ -677,13 +677,13 @@ EOT { local $/; # slurp mode my $io = $UncompressClass->new($name); - is $., 0; + is $., 0, "line 0"; is $io->input_line_number, 0; - ok ! $io->eof; + ok ! $io->eof, "eof"; my @lines = $io->getlines; - is $., 1; - is $io->input_line_number, 1; - ok $io->eof; + is $., 1, "line 1"; + is $io->input_line_number, 1, "line number 1"; + ok $io->eof, "eof" ; ok @lines == 1 && $lines[0] eq $str; $io = $UncompressClass->new($name); @@ -830,7 +830,6 @@ of a paragraph and a single line. EOT - my $lex = new LexFile my $name ; writeFile($name, $str); @@ -839,11 +838,11 @@ EOT { my $io = new $UncompressClass $name, -Transparent => 1 ; - ok defined $io; - ok ! $io->eof; - ok $io->tell() == 0 ; + isa_ok $io, $UncompressClass ; + ok ! $io->eof, "eof"; + is $io->tell(), 0, "tell == 0" ; my @lines = $io->getlines(); - is @lines, 6; + is @lines, 6, "got 6 lines"; ok $lines[1] eq "of a paragraph\n" ; ok join('', @lines) eq $str ; is $., 6; @@ -875,7 +874,7 @@ EOT my $line = $io->getline; is $., 1; is $io->input_line_number, 1; - ok $line eq $str; + is $line, $str; ok $io->eof; } @@ -1580,11 +1579,129 @@ EOT # } } -} + { + # Check can handle empty compressed files + # Test is for rt.cpan #67554 -1; + foreach my $type (qw(filename filehandle buffer )) + { + foreach my $append (0, 1) + { + title "$UncompressClass -- empty file read from $type, Append => $append"; + my $appended = "append"; + my $string = "some data"; + my $compressed ; + my $c = new $CompressClass(\$compressed); + $c->close(); + my $comp_len = length $compressed; + $compressed .= $appended if $append ; + my $lex = new LexFile my $name ; + my $input ; + writeFile ($name, $compressed); + if ($type eq 'buffer') + { + $input = \$compressed; + } + elsif ($type eq 'filename') + { + $input = $name; + } + elsif ($type eq 'filehandle') + { + my $fh = new IO::File "<$name" ; + ok $fh, "opened file $name ok"; + $input = $fh ; + } + + { + # Check that eof is true immediately after creating the + # uncompression object. + + # Check that readline returns undef + + my $x = new $UncompressClass $input, Transparent => 0 + or diag "$$UnError" ; + isa_ok $x, $UncompressClass; + + # should be EOF immediately + is $x->eof(), 1, "eof true"; + + is <$x>, undef, "getline is undef"; + + is $x->eof(), 1, "eof true"; + } + + { + # Check that read return an empty string + if ($type eq 'filehandle') + { + my $fh = new IO::File "<$name" ; + ok $fh, "opened file $name ok"; + $input = $fh ; + } + + my $x = new $UncompressClass $input, Transparent => 0 + or diag "$$UnError" ; + isa_ok $x, $UncompressClass; + + my $buffer; + is $x->read($buffer), 0, "read 0 bytes"; + ok defined $buffer, "buffer is defined"; + is $buffer, "", "buffer is empty string"; + + is $x->eof(), 1, "eof true"; + } + + { + # Check that read return an empty string in Append Mode + # to empty string + + if ($type eq 'filehandle') + { + my $fh = new IO::File "<$name" ; + ok $fh, "opened file $name ok"; + $input = $fh ; + } + my $x = new $UncompressClass $input, Transparent => 0, + Append => 1 + or diag "$$UnError" ; + isa_ok $x, $UncompressClass; + + my $buffer; + is $x->read($buffer), 0, "read 0 bytes"; + ok defined $buffer, "buffer is defined"; + is $buffer, "", "buffer is empty string"; + + is $x->eof(), 1, "eof true"; + } + { + # Check that read return an empty string in Append Mode + # to non-empty string + + if ($type eq 'filehandle') + { + my $fh = new IO::File "<$name" ; + ok $fh, "opened file $name ok"; + $input = $fh ; + } + my $x = new $UncompressClass($input, Append => 1 ); + isa_ok $x, $UncompressClass; + + my $buffer = "123"; + is $x->read($buffer), 0, "read 0 bytes"; + ok defined $buffer, "buffer is defined"; + is $buffer, "123", "buffer orig string"; + + is $x->eof(), 1, "eof true"; + } + } + } + } +} + +1; diff --git a/cpan/IO-Compress/t/compress/merge.pl b/cpan/IO-Compress/t/compress/merge.pl index 6134292466..9cb359c109 100644 --- a/cpan/IO-Compress/t/compress/merge.pl +++ b/cpan/IO-Compress/t/compress/merge.pl @@ -129,7 +129,7 @@ sub run ok ! $CompressClass->new($buffer, Merge => 1), " constructor fails"; { - like $$Error, '/Cannot create InflateScan object: (Header Error|unexpected end of file|Inflation Error: data error)/', " got Bad Magic" ; + like $$Error, '/Cannot create InflateScan object: (Header Error|unexpected end of file|Inflation Error: data error)?/', " got Bad Magic" ; } } diff --git a/cpan/IO-Compress/t/compress/oneshot.pl b/cpan/IO-Compress/t/compress/oneshot.pl index 78d17275b7..102f221da5 100644 --- a/cpan/IO-Compress/t/compress/oneshot.pl +++ b/cpan/IO-Compress/t/compress/oneshot.pl @@ -79,18 +79,18 @@ sub run } { - my $dir = "tmpdir"; + my $dir ; my $lex = new LexDir $dir ; - mkdir $dir, 0777 ; + my $d = quotemeta $dir; - $a = $Func->($dir, \$x) ; + $a = $Func->("$dir", \$x) ; is $a, undef, " $TopType returned undef"; - like $$Error, "/input file '$dir' is a directory/", + like $$Error, "/input file '$d' is a directory/", ' Input filename is a directory'; - $a = $Func->(\$x, $dir) ; + $a = $Func->(\$x, "$dir") ; is $a, undef, " $TopType returned undef"; - like $$Error, "/output file '$dir' is a directory/", + like $$Error, "/output file '$d' is a directory/", ' Output filename is a directory'; } @@ -890,21 +890,19 @@ sub run for my $files ( [qw(a1)], [qw(a1 a2 a3)] ) { - my $tmpDir1 = 'tmpdir1'; - my $tmpDir2 = 'tmpdir2'; + my $tmpDir1 ; + my $tmpDir2 ; my $lex = new LexDir($tmpDir1, $tmpDir2) ; - - mkdir $tmpDir1, 0777; - mkdir $tmpDir2, 0777; + my $d1 = quotemeta $tmpDir1 ; + my $d2 = quotemeta $tmpDir2 ; ok -d $tmpDir1, " Temp Directory $tmpDir1 exists"; - #ok ! -d $tmpDir2, " Temp Directory $tmpDir2 does not exist"; my @files = map { "$tmpDir1/$_.tmp" } @$files ; foreach (@files) { writeFile($_, "abc $_") } my @expected = map { "abc $_" } @files ; - my @outFiles = map { s/$tmpDir1/$tmpDir2/; $_ } @files ; + my @outFiles = map { s/$d1/$tmpDir2/; $_ } @files ; { title "$TopType - From FileGlob to FileGlob files [@$files]" ; @@ -961,8 +959,7 @@ sub run { title "$TopType - From FileGlob to Filename files [@$files], MS $ms" ; - my $filename = "abcde"; - my $lex = new LexFile($filename) ; + my $lex = new LexFile(my $filename) ; ok &$Func("<$tmpDir1/a*.tmp>" => $filename, MultiStream => $ms), ' Compressed ok' @@ -980,8 +977,7 @@ sub run { title "$TopType - From FileGlob to Filehandle files [@$files], MS $ms" ; - my $filename = "abcde"; - my $lex = new LexFile($filename) ; + my $lex = new LexFile(my $filename) ; my $fh = new IO::File ">$filename"; ok &$Func("<$tmpDir1/a*.tmp>" => $fh, @@ -1399,25 +1395,23 @@ sub run my $Func = getTopFuncRef($bit); my $TopType = getTopFuncName($bit); - my $tmpDir1 = 'tmpdir1'; - my $tmpDir2 = 'tmpdir2'; + my $tmpDir1 ; + my $tmpDir2 ; my $lex = new LexDir($tmpDir1, $tmpDir2) ; - - mkdir $tmpDir1, 0777; - mkdir $tmpDir2, 0777; + my $d1 = quotemeta $tmpDir1 ; + my $d2 = quotemeta $tmpDir2 ; my @opts = (); @opts = (RawInflate => 1, UnLzma => 1) if $bit eq 'IO::Uncompress::AnyUncompress'; ok -d $tmpDir1, " Temp Directory $tmpDir1 exists"; - #ok ! -d $tmpDir2, " Temp Directory $tmpDir2 does not exist"; my @files = map { "$tmpDir1/$_.tmp" } qw( a1 a2 a3) ; foreach (@files) { writeFile($_, compressBuffer($UncompressClass, "abc $_")) } my @expected = map { "abc $_" } @files ; - my @outFiles = map { s/$tmpDir1/$tmpDir2/; $_ } @files ; + my @outFiles = map { s/$d1/$tmpDir2/; $_ } @files ; { title "$TopType - From FileGlob to FileGlob" ; @@ -1475,8 +1469,7 @@ sub run { title "$TopType - From FileGlob to Filehandle" ; - my $output = 'abc' ; - my $lex = new LexFile $output ; + my $lex = new LexFile my $output ; my $fh = new IO::File ">$output" ; ok &$Func("<$tmpDir1/a*.tmp>" => $fh, AutoClose => 1, @opts), ' UnCompressed ok' or diag $$Error ; diff --git a/cpan/IO-Compress/t/compress/truncate.pl b/cpan/IO-Compress/t/compress/truncate.pl index 522dc70cfe..9f5eec9bb3 100644 --- a/cpan/IO-Compress/t/compress/truncate.pl +++ b/cpan/IO-Compress/t/compress/truncate.pl @@ -226,6 +226,7 @@ sub run 1 while <$gz> ; } ok $gz->error() ; + cmp_ok $gz->errorNo(), '<', 0 ; ok $gz->eof() ; $gz->close(); } diff --git a/cpan/IO-Compress/t/cz-03zlib-v1.t b/cpan/IO-Compress/t/cz-03zlib-v1.t index 677d141208..5f7a3d7764 100644 --- a/cpan/IO-Compress/t/cz-03zlib-v1.t +++ b/cpan/IO-Compress/t/cz-03zlib-v1.t @@ -336,7 +336,8 @@ title 'inflate - check remaining buffer after Z_STREAM_END'; title 'memGzip & memGunzip'; { - my $name = "test.gz" ; + my ($name, $name1, $name2, $name3); + my $lex = new LexFile $name, $name1, $name2, $name3 ; my $buffer = <<EOM; some sample text @@ -368,7 +369,7 @@ EOM ok $uncomp eq $buffer ; - 1 while unlink $name ; + #1 while unlink $name ; # now check that memGunzip can deal with it. my $ungzip = memGunzip($dest) ; @@ -383,13 +384,13 @@ EOM is $gzerrno, 0; # write it to disk - ok open(FH, ">$name") ; + ok open(FH, ">$name1") ; binmode(FH); print FH $dest ; close FH ; # uncompress with gzopen - ok $fil = gzopen($name, "rb") ; + ok $fil = gzopen($name1, "rb") ; ok (($x = $fil->gzread($uncomp)) == $len) ; @@ -459,7 +460,7 @@ EOM cmp_ok $gzerrno, "==", Z_DATA_ERROR ; - 1 while unlink $name ; + #1 while unlink $name ; # check corrupt header -- too short $dest = "x" ; diff --git a/cpan/IO-Compress/t/cz-06gzsetp.t b/cpan/IO-Compress/t/cz-06gzsetp.t index 44ed4f0ad0..b2cc687f5a 100644 --- a/cpan/IO-Compress/t/cz-06gzsetp.t +++ b/cpan/IO-Compress/t/cz-06gzsetp.t @@ -119,25 +119,28 @@ foreach my $CompressClass ('IO::Compress::Gzip', ok my $x = new $CompressClass(\$compressed) ; my $input .= $hello; - is $x->write($hello), $len_hello ; + is $x->write($hello), $len_hello, "wrote $len_hello bytes" ; # Change both Level & Strategy - ok $x->deflateParams(Z_BEST_SPEED, Z_HUFFMAN_ONLY); + ok $x->deflateParams(Z_BEST_SPEED, Z_HUFFMAN_ONLY), "deflateParams ok"; $input .= $goodbye; - is $x->write($goodbye), $len_goodbye ; + is $x->write($goodbye), $len_goodbye, "wrote $len_goodbye bytes" ; - ok $x->close ; + ok $x->close, "closed $CompressClass object" ; - ok my $k = new $UncompressClass(\$compressed); + my $k = new $UncompressClass(\$compressed); + isa_ok $k, $UncompressClass; my $len = length $input ; my $uncompressed; is $k->read($uncompressed, $len), $len or diag "$IO::Uncompress::Gunzip::GunzipError" ; - ok $uncompressed eq $input ; - ok $k->eof ; - ok $k->close ; - ok $k->eof ; + ok $uncompressed eq $input, "got expected uncompressed data" + or diag("unc len = " . length($uncompressed) . ", input len = " . + length($input) . "\n") ; + ok $k->eof, "eof" ; + ok $k->close, "closed" ; + ok $k->eof, "eof" ; } diff --git a/cpan/IO-Compress/t/globmapper.t b/cpan/IO-Compress/t/globmapper.t index 10a4d88716..0c60aa6b21 100644 --- a/cpan/IO-Compress/t/globmapper.t +++ b/cpan/IO-Compress/t/globmapper.t @@ -56,10 +56,12 @@ Perl $]" ) { title "input glob matches zero files"; - my $tmpDir = 'td'; + #my $tmpDir = 'td'; + my $tmpDir ; my $lex = new LexDir $tmpDir; + my $d = quotemeta $tmpDir; - my $gm = new File::GlobMapper("$tmpDir/Z*", '*.X'); + my $gm = new File::GlobMapper("$d/Z*", '*.X'); ok $gm, " created GlobMapper object" ; my $map = $gm->getFileMap() ; @@ -73,9 +75,10 @@ Perl $]" ) { title 'test wildcard mapping of * in destination'; - my $tmpDir = 'td'; + #my $tmpDir = 'td'; + my $tmpDir ; my $lex = new LexDir $tmpDir; - mkdir $tmpDir, 0777 ; + #mkdir $tmpDir, 0777 ; touch map { "$tmpDir/$_.tmp" } qw( abc1 abc2 abc3 ) ; @@ -101,9 +104,10 @@ Perl $]" ) { title 'no wildcards in input or destination'; - my $tmpDir = 'td'; + #my $tmpDir = 'td'; + my $tmpDir ; my $lex = new LexDir $tmpDir; - mkdir $tmpDir, 0777 ; + #mkdir $tmpDir, 0777 ; touch map { "$tmpDir/$_.tmp" } qw( abc1 abc2 abc3 ) ; @@ -125,9 +129,9 @@ Perl $]" ) { title 'test wildcard mapping of {} in destination'; - my $tmpDir = 'td'; + my $tmpDir ;#= 'td'; my $lex = new LexDir $tmpDir; - mkdir $tmpDir, 0777 ; + #mkdir $tmpDir, 0777 ; touch map { "$tmpDir/$_.tmp" } qw( abc1 abc2 abc3 ) ; @@ -160,9 +164,9 @@ Perl $]" ) { title 'test wildcard mapping of multiple * to #'; - my $tmpDir = 'td'; + my $tmpDir ;#= 'td'; my $lex = new LexDir $tmpDir; - mkdir $tmpDir, 0777 ; + #mkdir $tmpDir, 0777 ; touch map { "$tmpDir/$_.tmp" } qw( abc1 abc2 abc3 ) ; @@ -182,9 +186,9 @@ Perl $]" ) { title 'test wildcard mapping of multiple ? to #'; - my $tmpDir = 'td'; + my $tmpDir ;#= 'td'; my $lex = new LexDir $tmpDir; - mkdir $tmpDir, 0777 ; + #mkdir $tmpDir, 0777 ; touch map { "$tmpDir/$_.tmp" } qw( abc1 abc2 abc3 ) ; @@ -203,31 +207,31 @@ Perl $]" ) { title 'test wildcard mapping of multiple ?,* and [] to #'; - my $tmpDir = 'td'; + my $tmpDir ;#= 'td'; my $lex = new LexDir $tmpDir; - mkdir $tmpDir, 0777 ; + #mkdir $tmpDir, 0777 ; touch map { "$tmpDir/$_.tmp" } qw( abc1 abc2 abc3 ) ; - my $gm = new File::GlobMapper("./$tmpDir/?b[a-z]*.tmp", "./$tmpDir/X-#3-#2-#1-X"); + my $gm = new File::GlobMapper("$tmpDir/?b[a-z]*.tmp", "$tmpDir/X-#3-#2-#1-X"); ok $gm, " created GlobMapper object" ; #diag "Input pattern is $gm->{InputPattern}"; my $map = $gm->getFileMap() ; is @{ $map }, 3, " returned 3 maps"; is_deeply $map, - [ [map { "./$tmpDir/$_" } qw(abc1.tmp X-1-c-a-X)], - [map { "./$tmpDir/$_" } qw(abc2.tmp X-2-c-a-X)], - [map { "./$tmpDir/$_" } qw(abc3.tmp X-3-c-a-X)], + [ [map { "$tmpDir/$_" } qw(abc1.tmp X-1-c-a-X)], + [map { "$tmpDir/$_" } qw(abc2.tmp X-2-c-a-X)], + [map { "$tmpDir/$_" } qw(abc3.tmp X-3-c-a-X)], ], " got mapping"; } { title 'input glob matches a file multiple times'; - my $tmpDir = 'td'; + my $tmpDir ;#= 'td'; my $lex = new LexDir $tmpDir; - mkdir $tmpDir, 0777 ; + #mkdir $tmpDir, 0777 ; touch "$tmpDir/abc.tmp"; @@ -248,9 +252,9 @@ Perl $]" ) { title 'multiple input files map to one output file'; - my $tmpDir = 'td'; + my $tmpDir ;#= 'td'; my $lex = new LexDir $tmpDir; - mkdir $tmpDir, 0777 ; + #mkdir $tmpDir, 0777 ; touch map { "$tmpDir/$_.tmp" } qw( abc def) ; @@ -268,9 +272,9 @@ Perl $]" ) { title "globmap" ; - my $tmpDir = 'td'; + my $tmpDir ;#= 'td'; my $lex = new LexDir $tmpDir; - mkdir $tmpDir, 0777 ; + #mkdir $tmpDir, 0777 ; touch map { "$tmpDir/$_.tmp" } qw( abc1 abc2 abc3 ) ; |