From: Paul Marquess Date: Sat, 17 May 2008 12:16:13 +0000 (+0100) Subject: IO::Compress::* 2.011 X-Git-Tag: accepted/trunk/20130322.191538~13118 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1787f2408f7a147f42c53fb9c4380c9d71502ea;p=platform%2Fupstream%2Fperl.git IO::Compress::* 2.011 From: "Paul Marquess" Message-ID: p4raw-id: //depot/perl@33846 --- diff --git a/MANIFEST b/MANIFEST index 7a68a13..ad3c353 100644 --- a/MANIFEST +++ b/MANIFEST @@ -750,6 +750,7 @@ ext/IO_Compress_Zlib/t/002any-transparent.t IO::Compress::Zlib ext/IO_Compress_Zlib/t/002any-zip.t IO::Compress::Zlib ext/IO_Compress_Zlib/t/004gziphdr.t IO::Compress::Zlib ext/IO_Compress_Zlib/t/005defhdr.t IO::Compress::Zlib +ext/IO_Compress_Zlib/t/006zip.t IO::Compress::Zlib ext/IO_Compress_Zlib/t/010examples.t IO::Compress::Zlib ext/IO_Compress_Zlib/t/020isize.t IO::Compress::Zlib ext/IO_Compress_Zlib/t/050interop-gzip.t IO::Compress::Zlib diff --git a/ext/Compress/Raw/Zlib/Changes b/ext/Compress/Raw/Zlib/Changes index 7f76041..8a6ffc9 100644 --- a/ext/Compress/Raw/Zlib/Changes +++ b/ext/Compress/Raw/Zlib/Changes @@ -1,6 +1,11 @@ CHANGES ------- + 2.011 5 May 2008 + + * A C++-style comment sneaked in with the last update. Fixed. + [core patch #33828] + 2.010 5 May 2008 * No Changes diff --git a/ext/Compress/Raw/Zlib/README b/ext/Compress/Raw/Zlib/README index 240245f..f6f2896 100644 --- a/ext/Compress/Raw/Zlib/README +++ b/ext/Compress/Raw/Zlib/README @@ -1,9 +1,9 @@ Compress-Raw-Zlib - Version 2.010 + Version 2.011 - 5th May 2008 + 17th May 2008 Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it @@ -326,7 +326,7 @@ To help me help you, I need all of the following information: If you haven't installed Compress-Raw-Zlib then search Compress::Raw::Zlib.pm for a line like this: - $VERSION = "2.010" ; + $VERSION = "2.011" ; c. The version of zlib you have used. If you have successfully installed Compress-Raw-Zlib, this one-liner diff --git a/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm b/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm index 7e8ff17..77cb86e 100644 --- a/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm +++ b/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm @@ -13,7 +13,7 @@ use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); -$VERSION = '2.010'; +$VERSION = '2.011'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/ext/Compress/Zlib/Changes b/ext/Compress/Zlib/Changes index 0917142..60edccb 100644 --- a/ext/Compress/Zlib/Changes +++ b/ext/Compress/Zlib/Changes @@ -1,6 +1,10 @@ CHANGES ------- + 2.011 17 May 2008 + + * No Changes + 2.010 5 May 2008 * Fixed problem that meant Perl 5.10 could not upgrade this module. diff --git a/ext/Compress/Zlib/Makefile.PL b/ext/Compress/Zlib/Makefile.PL index 270c55c..e79a132 100755 --- a/ext/Compress/Zlib/Makefile.PL +++ b/ext/Compress/Zlib/Makefile.PL @@ -3,7 +3,7 @@ use strict ; require 5.004 ; -$::VERSION = '2.010' ; +$::VERSION = '2.011' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; diff --git a/ext/Compress/Zlib/README b/ext/Compress/Zlib/README index 4308b9c..0b550b5 100644 --- a/ext/Compress/Zlib/README +++ b/ext/Compress/Zlib/README @@ -1,9 +1,9 @@ Compress-Zlib - Version 2.010 + Version 2.011 - 5th May 2008 + 17th May 2008 Copyright (c) 1995-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it @@ -106,7 +106,7 @@ To help me help you, I need all of the following information: If you haven't installed Compress-Zlib then search Compress::Zlib.pm for a line like this: - $VERSION = "2.010" ; + $VERSION = "2.011" ; 2. If you are having problems building Compress-Zlib, send me a complete log of what happened. Start by unpacking the Compress-Zlib diff --git a/ext/Compress/Zlib/lib/Compress/Zlib.pm b/ext/Compress/Zlib/lib/Compress/Zlib.pm index dc7cb5e..d662afc 100644 --- a/ext/Compress/Zlib/lib/Compress/Zlib.pm +++ b/ext/Compress/Zlib/lib/Compress/Zlib.pm @@ -8,17 +8,17 @@ use Carp ; use IO::Handle ; use Scalar::Util qw(dualvar); -use IO::Compress::Base::Common 2.010 ; -use Compress::Raw::Zlib 2.010 ; -use IO::Compress::Gzip 2.010 ; -use IO::Uncompress::Gunzip 2.010 ; +use IO::Compress::Base::Common 2.011 ; +use Compress::Raw::Zlib 2.011 ; +use IO::Compress::Gzip 2.011 ; +use IO::Uncompress::Gunzip 2.011 ; use strict ; use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); -$VERSION = '2.010'; +$VERSION = '2.011'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -452,7 +452,7 @@ sub inflate package Compress::Zlib ; -use IO::Compress::Gzip::Constants 2.010 ; +use IO::Compress::Gzip::Constants 2.011 ; sub memGzip($) { diff --git a/ext/IO_Compress_Base/Changes b/ext/IO_Compress_Base/Changes index 5316c7b..bab7a7e 100644 --- a/ext/IO_Compress_Base/Changes +++ b/ext/IO_Compress_Base/Changes @@ -1,6 +1,18 @@ CHANGES ------- + 2.011 17 May 2008 + + * IO::Compress::Base + - Fixed problem that prevented the creation of a zip file that + contained more than one compression method. + + * IO::Compress::Base::Common + - The private Validator class in this module clashes with another + CPAN module. Moved Validator into the IO::Compress::Base::Common + namespace. + [RT #35954] + 2.010 5 May 2008 * Fixed problem that meant Perl 5.10 could not upgrade this module. diff --git a/ext/IO_Compress_Base/README b/ext/IO_Compress_Base/README index b159fd7..f9d011b 100644 --- a/ext/IO_Compress_Base/README +++ b/ext/IO_Compress_Base/README @@ -1,9 +1,9 @@ IO-Compress-Base - Version 2.010 + Version 2.011 - 5th May 2008 + 17th May 2008 Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it @@ -76,7 +76,7 @@ To help me help you, I need all of the following information: If you haven't installed IO-Compress-Base then search IO::Compress::Base.pm for a line like this: - $VERSION = "2.010" ; + $VERSION = "2.011" ; 2. If you are having problems building IO-Compress-Base, send me a complete log of what happened. Start by unpacking the IO-Compress-Base diff --git a/ext/IO_Compress_Base/lib/IO/Compress/Base.pm b/ext/IO_Compress_Base/lib/IO/Compress/Base.pm index 36939e1..9f05ed8 100644 --- a/ext/IO_Compress_Base/lib/IO/Compress/Base.pm +++ b/ext/IO_Compress_Base/lib/IO/Compress/Base.pm @@ -6,7 +6,7 @@ require 5.004 ; use strict ; use warnings; -use IO::Compress::Base::Common 2.010 ; +use IO::Compress::Base::Common 2.011 ; use IO::File ; use Scalar::Util qw(blessed readonly); @@ -20,7 +20,7 @@ use bytes; our (@ISA, $VERSION); @ISA = qw(Exporter IO::File); -$VERSION = '2.010'; +$VERSION = '2.011'; #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. @@ -236,7 +236,7 @@ sub _create my $status ; if (! $merge) { - *$obj->{Compress} = $obj->mkComp($class, $got) + *$obj->{Compress} = $obj->mkComp($got) or return undef; *$obj->{UnCompSize} = new U64 ; @@ -323,7 +323,7 @@ sub _def my $haveOut = @_ ; my $output = shift ; - my $x = new Validator($class, *$obj->{Error}, $name, $input, $output) + my $x = new IO::Compress::Base::Validator($class, *$obj->{Error}, $name, $input, $output) or return undef ; push @_, $output if $haveOut && $x->{Hash}; @@ -699,15 +699,13 @@ sub newStream $self->ckParams($got) or $self->croakError("newStream: $self->{Error}"); + *$self->{Compress} = $self->mkComp($got) + or return 0; + *$self->{Header} = $self->mkHeader($got) ; $self->output(*$self->{Header} ) or return 0; - my $status = $self->reset() ; - return $self->saveErrorString(0, *$self->{Compress}{Error}, - *$self->{Compress}{ErrorNo}) - if $status == STATUS_ERROR; - *$self->{UnCompSize}->reset(); *$self->{CompSize}->reset(); @@ -977,3 +975,4 @@ Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + diff --git a/ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm b/ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm index 68e8d6d..a5b0975 100644 --- a/ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm +++ b/ext/IO_Compress_Base/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.010'; +$VERSION = '2.011'; @EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput isaFileGlobString cleanFileGlobString oneTarget @@ -192,7 +192,7 @@ sub oneTarget return $_[0] =~ /^(code|handle|buffer|filename)$/; } -sub Validator::new +sub IO::Compress::Base::Validator::new { my $class = shift ; @@ -320,7 +320,7 @@ sub Validator::new return $obj ; } -sub Validator::saveErrorString +sub IO::Compress::Base::Validator::saveErrorString { my $self = shift ; ${ $self->{Error} } = shift ; @@ -328,7 +328,7 @@ sub Validator::saveErrorString } -sub Validator::croakError +sub IO::Compress::Base::Validator::croakError { my $self = shift ; $self->saveErrorString($_[0]); @@ -337,7 +337,7 @@ sub Validator::croakError -sub Validator::validateInputFilenames +sub IO::Compress::Base::Validator::validateInputFilenames { my $self = shift ; @@ -367,7 +367,7 @@ sub Validator::validateInputFilenames return 1 ; } -sub Validator::validateInputArray +sub IO::Compress::Base::Validator::validateInputArray { my $self = shift ; @@ -398,7 +398,7 @@ sub Validator::validateInputArray return 1 ; } -#sub Validator::validateHash +#sub IO::Compress::Base::Validator::validateHash #{ # my $self = shift ; # my $href = shift ; diff --git a/ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm b/ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm index 3b8402c..8888577 100644 --- a/ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm +++ b/ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm @@ -4,16 +4,16 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.010 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.011 qw(createSelfTiedObject); -use IO::Uncompress::Base 2.010 ; +use IO::Uncompress::Base 2.011 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError); -$VERSION = '2.010'; +$VERSION = '2.011'; $AnyUncompressError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -27,18 +27,18 @@ Exporter::export_ok_tags('all'); BEGIN { - eval ' use IO::Uncompress::Adapter::Inflate 2.010 ;'; - eval ' use IO::Uncompress::Adapter::Bunzip2 2.010 ;'; - eval ' use IO::Uncompress::Adapter::LZO 2.010 ;'; - eval ' use IO::Uncompress::Adapter::Lzf 2.010 ;'; - - eval ' use IO::Uncompress::Bunzip2 2.010 ;'; - eval ' use IO::Uncompress::UnLzop 2.010 ;'; - eval ' use IO::Uncompress::Gunzip 2.010 ;'; - eval ' use IO::Uncompress::Inflate 2.010 ;'; - eval ' use IO::Uncompress::RawInflate 2.010 ;'; - eval ' use IO::Uncompress::Unzip 2.010 ;'; - eval ' use IO::Uncompress::UnLzf 2.010 ;'; + eval ' use IO::Uncompress::Adapter::Inflate 2.011 ;'; + eval ' use IO::Uncompress::Adapter::Bunzip2 2.011 ;'; + eval ' use IO::Uncompress::Adapter::LZO 2.011 ;'; + eval ' use IO::Uncompress::Adapter::Lzf 2.011 ;'; + + eval ' use IO::Uncompress::Bunzip2 2.011 ;'; + eval ' use IO::Uncompress::UnLzop 2.011 ;'; + eval ' use IO::Uncompress::Gunzip 2.011 ;'; + eval ' use IO::Uncompress::Inflate 2.011 ;'; + eval ' use IO::Uncompress::RawInflate 2.011 ;'; + eval ' use IO::Uncompress::Unzip 2.011 ;'; + eval ' use IO::Uncompress::UnLzf 2.011 ;'; } sub new @@ -56,7 +56,7 @@ sub anyuncompress sub getExtraParams { - use IO::Compress::Base::Common 2.010 qw(:Parse); + use IO::Compress::Base::Common 2.011 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ; } @@ -75,7 +75,6 @@ sub ckParams sub mkUncomp { my $self = shift ; - my $class = shift ; my $got = shift ; my $magic ; diff --git a/ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm b/ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm index adb54c6..4493042 100644 --- a/ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm +++ b/ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm @@ -9,12 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter IO::File); -$VERSION = '2.010'; +$VERSION = '2.011'; use constant G_EOF => 0 ; use constant G_ERR => -1 ; -use IO::Compress::Base::Common 2.010 ; +use IO::Compress::Base::Common 2.011 ; #use Parse::Parameters ; use IO::File ; @@ -468,7 +468,7 @@ sub _create return $obj } - my $status = $obj->mkUncomp($class, $got); + my $status = $obj->mkUncomp($got); return undef unless defined $status; @@ -533,7 +533,7 @@ sub _inf my $output = shift ; - my $x = new Validator($class, *$obj->{Error}, $name, $input, $output) + my $x = new IO::Compress::Base::Validator($class, *$obj->{Error}, $name, $input, $output) or return undef ; push @_, $output if $haveOut && $x->{Hash}; @@ -1451,3 +1451,4 @@ Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + diff --git a/ext/IO_Compress_Zlib/Changes b/ext/IO_Compress_Zlib/Changes index ba79b78..45cd027 100644 --- a/ext/IO_Compress_Zlib/Changes +++ b/ext/IO_Compress_Zlib/Changes @@ -1,6 +1,16 @@ CHANGES ------- + 2.011 17 May 2008 + + * IO::Uncompress::Unzip + - Print an error message if the zip file contains a + member compressed with bzip2 and IO::Uncompress::Bunzip2 is + not available. + - Could not cope with mixed compression zip files. For example a + zip file that contains both STORED and DEFLATED content. + [RT #35573] + 2.010 5 May 2008 * Fixed problem that meant Perl 5.10 could not upgrade this module. diff --git a/ext/IO_Compress_Zlib/Makefile.PL b/ext/IO_Compress_Zlib/Makefile.PL index a2130aa..deb323e 100644 --- a/ext/IO_Compress_Zlib/Makefile.PL +++ b/ext/IO_Compress_Zlib/Makefile.PL @@ -3,7 +3,7 @@ use strict ; require 5.004 ; -$::VERSION = '2.010' ; +$::VERSION = '2.011' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; diff --git a/ext/IO_Compress_Zlib/README b/ext/IO_Compress_Zlib/README index 9c403e6..176bcff 100644 --- a/ext/IO_Compress_Zlib/README +++ b/ext/IO_Compress_Zlib/README @@ -1,9 +1,9 @@ IO-Compress-Zlib - Version 2.010 + Version 2.011 - 5th May 2008 + 17th May 2008 Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it @@ -93,7 +93,7 @@ To help me help you, I need all of the following information: If you haven't installed IO-Compress-Zlib then search IO::Compress::Gzip.pm for a line like this: - $VERSION = "2.010" ; + $VERSION = "2.011" ; 2. If you are having problems building IO-Compress-Zlib, send me a complete log of what happened. Start by unpacking the IO-Compress-Zlib diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm index c269d4f..d8f5a5f 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.010 qw(:Status); +use IO::Compress::Base::Common 2.011 qw(:Status); -use Compress::Raw::Zlib 2.010 qw(Z_OK Z_FINISH MAX_WBITS) ; +use Compress::Raw::Zlib 2.011 qw(Z_OK Z_FINISH MAX_WBITS) ; our ($VERSION); -$VERSION = '2.010'; +$VERSION = '2.011'; sub mkCompObject { diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm index 2eef317..ad7347c 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm @@ -4,10 +4,10 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.010 qw(:Status); +use IO::Compress::Base::Common 2.011 qw(:Status); our ($VERSION); -$VERSION = '2.010'; +$VERSION = '2.011'; sub mkCompObject { diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm index c5d1d02..e702e43 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm @@ -6,16 +6,16 @@ use bytes; require Exporter ; -use IO::Compress::RawDeflate 2.010 ; +use IO::Compress::RawDeflate 2.011 ; -use Compress::Raw::Zlib 2.010 ; -use IO::Compress::Zlib::Constants 2.010 ; -use IO::Compress::Base::Common 2.010 qw(createSelfTiedObject); +use Compress::Raw::Zlib 2.011 ; +use IO::Compress::Zlib::Constants 2.011 ; +use IO::Compress::Base::Common 2.011 qw(createSelfTiedObject); our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError); -$VERSION = '2.010'; +$VERSION = '2.011'; $DeflateError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm index 4bea560..86561c5 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm @@ -8,12 +8,12 @@ use warnings; use bytes; -use IO::Compress::RawDeflate 2.010 ; +use IO::Compress::RawDeflate 2.011 ; -use Compress::Raw::Zlib 2.010 ; -use IO::Compress::Base::Common 2.010 qw(:Status :Parse createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.010 ; -use IO::Compress::Zlib::Extra 2.010 ; +use Compress::Raw::Zlib 2.011 ; +use IO::Compress::Base::Common 2.011 qw(:Status :Parse createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.011 ; +use IO::Compress::Zlib::Extra 2.011 ; BEGIN { @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError); -$VERSION = '2.010'; +$VERSION = '2.011'; $GzipError = '' ; @ISA = qw(Exporter IO::Compress::RawDeflate); diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm index 0c0b168..2f59d22 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm +++ b/ext/IO_Compress_Zlib/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.010'; +$VERSION = '2.011'; @ISA = qw(Exporter); diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm index e728d53..81245f2 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm @@ -7,16 +7,16 @@ use warnings; use bytes; -use IO::Compress::Base 2.010 ; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); -use IO::Compress::Adapter::Deflate 2.010 ; +use IO::Compress::Base 2.011 ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); +use IO::Compress::Adapter::Deflate 2.011 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); -$VERSION = '2.010'; +$VERSION = '2.011'; $RawDeflateError = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -92,7 +92,6 @@ sub ckParams sub mkComp { my $self = shift ; - my $class = shift ; my $got = shift ; my ($obj, $errstr, $errno) = IO::Compress::Adapter::Deflate::mkCompObject( @@ -143,8 +142,8 @@ sub getZlibParams { my $self = shift ; - use IO::Compress::Base::Common 2.010 qw(:Parse); - use Compress::Raw::Zlib 2.010 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.011 qw(:Parse); + use Compress::Raw::Zlib 2.011 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); return ( diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm index 752763d..f2ff60e 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm @@ -4,21 +4,21 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); -use IO::Compress::RawDeflate 2.010 ; -use IO::Compress::Adapter::Deflate 2.010 ; -use IO::Compress::Adapter::Identity 2.010 ; -use IO::Compress::Zlib::Extra 2.010 ; -use IO::Compress::Zip::Constants 2.010 ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); +use IO::Compress::RawDeflate 2.011 ; +use IO::Compress::Adapter::Deflate 2.011 ; +use IO::Compress::Adapter::Identity 2.011 ; +use IO::Compress::Zlib::Extra 2.011 ; +use IO::Compress::Zip::Constants 2.011 ; -use Compress::Raw::Zlib 2.010 qw(crc32) ; +use Compress::Raw::Zlib 2.011 qw(crc32) ; BEGIN { eval { require IO::Compress::Adapter::Bzip2 ; - import IO::Compress::Adapter::Bzip2 2.010 ; + import IO::Compress::Adapter::Bzip2 2.011 ; require IO::Compress::Bzip2 ; - import IO::Compress::Bzip2 2.010 ; + import IO::Compress::Bzip2 2.011 ; } ; } @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError); -$VERSION = '2.010'; +$VERSION = '2.011'; $ZipError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -57,7 +57,6 @@ sub zip sub mkComp { my $self = shift ; - my $class = shift ; my $got = shift ; my ($obj, $errstr, $errno) ; @@ -453,8 +452,8 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.010 qw(:Parse); - use Compress::Raw::Zlib 2.010 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.011 qw(:Parse); + use Compress::Raw::Zlib 2.011 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); my @Bzip2 = (); diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm index b49f6d7..85e9767 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm @@ -7,7 +7,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS); -$VERSION = '2.010'; +$VERSION = '2.011'; @ISA = qw(Exporter); @@ -33,6 +33,7 @@ $VERSION = '2.010'; ZIP_GP_FLAG_PATCHED_MASK ZIP_GP_FLAG_STRONG_ENCRYPTED_MASK ZIP_GP_FLAG_LZMA_EOS_PRESENT + ZIP_GP_FLAG_LANGUAGE_ENCODING ZIP_EXTRA_ID_ZIP64 ZIP_EXTRA_ID_EXT_TIMESTAMP @@ -83,6 +84,7 @@ use constant ZIP_OS_CODE_DEFAULT => 3; use constant ZIP_EXTRA_ID_ZIP64 => pack "v", 1; use constant ZIP_EXTRA_ID_EXT_TIMESTAMP => "UT"; use constant ZIP_EXTRA_ID_INFO_ZIP_UNIX2 => "Ux"; +use constant ZIP_EXTRA_ID_JAVA_EXE => pack "v", 0xCAFE; use constant ZIP64_MIN_VERSION => 45; diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm index 6535fe1..f57f6a2 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT); -$VERSION = '2.010'; +$VERSION = '2.011'; @ISA = qw(Exporter); diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm index 0ab3bf5..92109fa 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm @@ -8,9 +8,9 @@ use bytes; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = '2.010'; +$VERSION = '2.011'; -use IO::Compress::Gzip::Constants 2.010 ; +use IO::Compress::Gzip::Constants 2.011 ; sub ExtraFieldError { diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm index 0435825..91e9be2 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm @@ -4,13 +4,13 @@ use warnings; use strict; use bytes; -use IO::Compress::Base::Common 2.010 qw(:Status); +use IO::Compress::Base::Common 2.011 qw(:Status); our ($VERSION); -$VERSION = '2.010'; +$VERSION = '2.011'; -use Compress::Raw::Zlib 2.010 (); +use Compress::Raw::Zlib 2.011 (); sub mkUncompObject { diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm index e3c6e71..b93b1d8 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm @@ -4,11 +4,11 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.010 qw(:Status); -use Compress::Raw::Zlib 2.010 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); +use IO::Compress::Base::Common 2.011 qw(:Status); +use Compress::Raw::Zlib 2.011 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); our ($VERSION); -$VERSION = '2.010'; +$VERSION = '2.011'; diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm index d1a2477..f604acb 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm @@ -6,22 +6,22 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.010 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.011 qw(createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.010 (); +use IO::Uncompress::Adapter::Inflate 2.011 (); -use IO::Uncompress::Base 2.010 ; -use IO::Uncompress::Gunzip 2.010 ; -use IO::Uncompress::Inflate 2.010 ; -use IO::Uncompress::RawInflate 2.010 ; -use IO::Uncompress::Unzip 2.010 ; +use IO::Uncompress::Base 2.011 ; +use IO::Uncompress::Gunzip 2.011 ; +use IO::Uncompress::Inflate 2.011 ; +use IO::Uncompress::RawInflate 2.011 ; +use IO::Uncompress::Unzip 2.011 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError); -$VERSION = '2.010'; +$VERSION = '2.011'; $AnyInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -48,7 +48,7 @@ sub anyinflate sub getExtraParams { - use IO::Compress::Base::Common 2.010 qw(:Parse); + use IO::Compress::Base::Common 2.011 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ; } @@ -67,7 +67,6 @@ sub ckParams sub mkUncomp { my $self = shift ; - my $class = shift ; my $got = shift ; my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject(); diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm index e6cce8e..494cc38 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm @@ -9,12 +9,12 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.010 ; +use IO::Uncompress::RawInflate 2.011 ; -use Compress::Raw::Zlib 2.010 qw( crc32 ) ; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.010 ; -use IO::Compress::Zlib::Extra 2.010 ; +use Compress::Raw::Zlib 2.011 qw( crc32 ) ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.011 ; +use IO::Compress::Zlib::Extra 2.011 ; require Exporter ; @@ -28,7 +28,7 @@ Exporter::export_ok_tags('all'); $GunzipError = ''; -$VERSION = '2.010'; +$VERSION = '2.011'; sub new { @@ -47,7 +47,7 @@ sub gunzip sub getExtraParams { - use IO::Compress::Base::Common 2.010 qw(:Parse); + use IO::Compress::Base::Common 2.011 qw(:Parse); return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ; } diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm index 52b3ded..1a74bf4 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm @@ -5,15 +5,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); -use IO::Compress::Zlib::Constants 2.010 ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); +use IO::Compress::Zlib::Constants 2.011 ; -use IO::Uncompress::RawInflate 2.010 ; +use IO::Uncompress::RawInflate 2.011 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError); -$VERSION = '2.010'; +$VERSION = '2.011'; $InflateError = ''; @ISA = qw( Exporter IO::Uncompress::RawInflate ); diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm index c251edc..64f85bf 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm @@ -5,11 +5,11 @@ use strict ; use warnings; use bytes; -use Compress::Raw::Zlib 2.010 ; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); +use Compress::Raw::Zlib 2.011 ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); -use IO::Uncompress::Base 2.010 ; -use IO::Uncompress::Adapter::Inflate 2.010 ; +use IO::Uncompress::Base 2.011 ; +use IO::Uncompress::Adapter::Inflate 2.011 ; @@ -17,7 +17,7 @@ use IO::Uncompress::Adapter::Inflate 2.010 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError); -$VERSION = '2.010'; +$VERSION = '2.011'; $RawInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -58,7 +58,6 @@ sub ckParams sub mkUncomp { my $self = shift ; - my $class = shift ; my $got = shift ; my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject( diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm index 2a31f73..c50259f 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm @@ -8,13 +8,14 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.010 ; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); -use IO::Uncompress::Adapter::Identity 2.010 ; -use IO::Compress::Zlib::Extra 2.010 ; -use IO::Compress::Zip::Constants 2.010 ; +use IO::Uncompress::RawInflate 2.011 ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); +use IO::Uncompress::Adapter::Inflate 2.011 ; +use IO::Uncompress::Adapter::Identity 2.011 ; +use IO::Compress::Zlib::Extra 2.011 ; +use IO::Compress::Zip::Constants 2.011 ; -use Compress::Raw::Zlib 2.010 qw(crc32) ; +use Compress::Raw::Zlib 2.011 qw(crc32) ; BEGIN { @@ -27,7 +28,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup); -$VERSION = '2.010'; +$VERSION = '2.011'; $UnzipError = ''; @ISA = qw(Exporter IO::Uncompress::RawInflate); @@ -60,7 +61,7 @@ sub unzip sub getExtraParams { - use IO::Compress::Base::Common 2.010 qw(:Parse); + use IO::Compress::Base::Common 2.011 qw(:Parse); return ( @@ -84,6 +85,20 @@ sub ckParams return 1; } +sub mkUncomp +{ + my $self = shift ; + my $got = shift ; + + my $magic = $self->ckMagic() + or return 0; + + *$self->{Info} = $self->readHeader($magic) + or return undef ; + + return 1; + +} sub ckMagic { @@ -585,19 +600,22 @@ sub _readZipHeader($) if ($compressedMethod == ZIP_CM_DEFLATE) { *$self->{Type} = 'zip-deflate'; + my $obj = IO::Uncompress::Adapter::Inflate::mkUncompObject(1,0,0); + + *$self->{Uncomp} = $obj; + *$self->{ZipData}{CRC32} = crc32(undef); } elsif ($compressedMethod == ZIP_CM_BZIP2) { - #if (! defined $IO::Uncompress::Adapter::Bunzip2::VERSION) + return $self->HeaderError("Unsupported Compression format $compressedMethod") + if ! defined $IO::Uncompress::Adapter::Bunzip2::VERSION ; *$self->{Type} = 'zip-bzip2'; - my $obj = IO::Uncompress::Adapter::Bunzip2::mkUncompObject( - ); + my $obj = IO::Uncompress::Adapter::Bunzip2::mkUncompObject(); *$self->{Uncomp} = $obj; *$self->{ZipData}{CRC32} = crc32(undef); - } elsif ($compressedMethod == ZIP_CM_STORE) { @@ -605,12 +623,9 @@ sub _readZipHeader($) *$self->{Type} = 'zip-stored'; - my $obj = IO::Uncompress::Adapter::Identity::mkUncompObject(# $got->value('CRC32'), - # $got->value('ADLER32'), - ); + my $obj = IO::Uncompress::Adapter::Identity::mkUncompObject(); *$self->{Uncomp} = $obj; - } else { @@ -1402,9 +1417,11 @@ stream at a time. my $zipfile = "somefile.zip"; my $u = new IO::Uncompress::Unzip $zipfile - or die "Cannot open $filefile: $UnzipError"; + or die "Cannot open $zipfile: $UnzipError"; - for (my $status = 1; ! $u->eof(); $status = $u->nextStream()) + my $status; + for ($status = 1; ! $u->eof(); $status = $u->nextStream()) + { my $name = $u->getHeaderInfo()->{Name}; warn "Processing member $name\n" ; diff --git a/ext/IO_Compress_Zlib/t/006zip.t b/ext/IO_Compress_Zlib/t/006zip.t new file mode 100644 index 0000000..83dabca --- /dev/null +++ b/ext/IO_Compress_Zlib/t/006zip.t @@ -0,0 +1,251 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + @INC = ("../lib", "lib/compress"); + } +} + +use lib qw(t t/compress); +use strict; +use warnings; +use bytes; + +use Test::More ; +use CompTestUtils; + +BEGIN { + # use Test::NoWarnings, if available + my $extra = 0 ; + $extra = 1 + if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; + + plan tests => 62 + $extra ; + + use_ok('IO::Compress::Zip', qw(:all)) ; + use_ok('IO::Uncompress::Unzip', qw(unzip $UnzipError)) ; + + eval { + require IO::Compress::Bzip2 ; + import IO::Compress::Bzip2 2.010 ; + require IO::Uncompress::Bunzip2 ; + import IO::Uncompress::Bunzip2 2.010 ; + } ; + +} + + +sub getContent +{ + my $filename = shift; + + my $u = new IO::Uncompress::Unzip $filename, Append => 1 + or die "Cannot open $filename: $UnzipError"; + + isa_ok $u, "IO::Uncompress::Unzip"; + + my @content; + my $status ; + + for ($status = 1; ! $u->eof(); $status = $u->nextStream()) + { + + my $name = $u->getHeaderInfo()->{Name}; + #warn "Processing member $name\n" ; + + my $buff = ''; + 1 while ($status = $u->read($buff)) > 0; + + push @content, $buff; + last unless $status == 0; + } + + die "Error processing $filename: $status $!\n" + if $status < 0 ; + + return @content; +} + + +{ + title "Create a simple zip - All Deflate"; + + my $lex = new LexFile my $file1; + + my @content = ( + 'hello', + '', + 'goodbye ', + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_DEFLATE); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + is $got[1], $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + +SKIP: +{ + title "Create a simple zip - All Bzip2"; + + skip "IO::Compress::Bzip2 not available", 9 + unless defined $IO::Compress::Bzip2::VERSION; + + my $lex = new LexFile my $file1; + + my @content = ( + 'hello', + '', + 'goodbye ', + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_BZIP2, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_BZIP2); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_BZIP2); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + is $got[1], $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + +SKIP: +{ + title "Create a simple zip - Deflate + Bzip2"; + + skip "IO::Compress::Bzip2 not available", 9 + unless $IO::Compress::Bzip2::VERSION; + + my $lex = new LexFile my $file1; + + my @content = ( + 'hello', + 'and', + 'goodbye ', + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_BZIP2); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + is $got[1], $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + +{ + title "Create a simple zip - All STORE"; + + my $lex = new LexFile my $file1; + + my @content = ( + 'hello', + '', + 'goodbye ', + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_STORE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_STORE); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_STORE); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + is $got[1], $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + +{ + title "Create a simple zip - Deflate + STORE"; + + #my $lex = new LexFile my $file1; + my $file1 = "tryout.zip"; + + my @content = qw( + hello + and + goodbye + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_STORE); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + is $got[1], $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + +{ + title "Create a simple zip - Deflate + zero length STORE"; + + my $lex = new LexFile my $file1; + + my @content = ( + 'hello ', + '', + 'goodbye ', + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_STORE); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + ok $got[1] eq $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} +