From 422d6414d26e413a69e401207deaf53fb640b369 Mon Sep 17 00:00:00 2001 From: Chris 'BinGOs' Williams Date: Sun, 29 Jan 2012 00:24:18 +0000 Subject: Update IO-Compress to CPAN version 2.047 [DELTA] 2.047 28 January 2012 * Set minimum Perl version to 5.6 * IO::Compress::Zip - In one-shot zip, set the Text Flag if "-T" thinks the file is a text file. - In one-shot mode, wrote mod time & access time in wrong order in the "UT" extended field. --- cpan/IO-Compress/Changes | 10 +++ cpan/IO-Compress/Makefile.PL | 4 +- cpan/IO-Compress/README | 8 +- cpan/IO-Compress/bin/zipdetails | 2 +- cpan/IO-Compress/lib/Compress/Zlib.pm | 18 ++-- cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm | 6 +- .../IO-Compress/lib/IO/Compress/Adapter/Deflate.pm | 18 ++-- .../lib/IO/Compress/Adapter/Identity.pm | 4 +- cpan/IO-Compress/lib/IO/Compress/Base.pm | 40 +++++++-- cpan/IO-Compress/lib/IO/Compress/Base/Common.pm | 3 +- cpan/IO-Compress/lib/IO/Compress/Bzip2.pm | 10 +-- cpan/IO-Compress/lib/IO/Compress/Deflate.pm | 17 ++-- cpan/IO-Compress/lib/IO/Compress/FAQ.pod | 2 +- cpan/IO-Compress/lib/IO/Compress/Gzip.pm | 25 +++--- cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm | 2 +- cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm | 43 +++------- cpan/IO-Compress/lib/IO/Compress/Zip.pm | 99 +++++++++++++++------- cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm | 3 +- cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm | 2 +- cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm | 6 +- .../lib/IO/Uncompress/Adapter/Bunzip2.pm | 6 +- .../lib/IO/Uncompress/Adapter/Identity.pm | 6 +- .../lib/IO/Uncompress/Adapter/Inflate.pm | 6 +- cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm | 20 ++--- .../IO-Compress/lib/IO/Uncompress/AnyUncompress.pm | 42 ++++----- cpan/IO-Compress/lib/IO/Uncompress/Base.pm | 6 +- cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm | 10 +-- cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm | 20 ++--- cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm | 10 +-- cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm | 12 +-- cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm | 28 +++--- cpan/IO-Compress/t/000prereq.t | 2 +- cpan/IO-Compress/t/006zip.t | 12 ++- cpan/IO-Compress/t/111const-deflate.t | 81 ++++++++++++++++++ cpan/IO-Compress/t/cz-03zlib-v1.t | 25 +++++- cpan/IO-Compress/t/cz-14gzopen.t | 16 +++- 36 files changed, 404 insertions(+), 220 deletions(-) create mode 100644 cpan/IO-Compress/t/111const-deflate.t (limited to 'cpan/IO-Compress') diff --git a/cpan/IO-Compress/Changes b/cpan/IO-Compress/Changes index 0d00b000c7..cab9b13807 100644 --- a/cpan/IO-Compress/Changes +++ b/cpan/IO-Compress/Changes @@ -1,6 +1,16 @@ CHANGES ------- + 2.047 28 January 2012 + + * Set minimum Perl version to 5.6 + + * IO::Compress::Zip + - In one-shot zip, set the Text Flag if "-T" thinks the file is a + text file. + - In one-shot mode, wrote mod time & access time in wrong order + in the "UT" extended field. + 2.046 18 December 2011 * Minor update to bin/zipdetails diff --git a/cpan/IO-Compress/Makefile.PL b/cpan/IO-Compress/Makefile.PL index 84706258b2..62231a9a64 100644 --- a/cpan/IO-Compress/Makefile.PL +++ b/cpan/IO-Compress/Makefile.PL @@ -1,9 +1,9 @@ #! perl -w use strict ; -require 5.004 ; +require 5.006 ; -$::VERSION = '2.045' ; +$::VERSION = '2.047' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; diff --git a/cpan/IO-Compress/README b/cpan/IO-Compress/README index e13ea76a7b..c692f7cb42 100644 --- a/cpan/IO-Compress/README +++ b/cpan/IO-Compress/README @@ -1,11 +1,11 @@ IO-Compress - Version 2.046 + Version 2.047 - 18th December 2011 + 28th January 2012 - Copyright (c) 1995-2011 Paul Marquess. All rights reserved. + Copyright (c) 1995-2012 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. @@ -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.045" ; + $VERSION = "2.047" ; 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/bin/zipdetails b/cpan/IO-Compress/bin/zipdetails index 6e405f3c8e..2b5cd52cec 100644 --- a/cpan/IO-Compress/bin/zipdetails +++ b/cpan/IO-Compress/bin/zipdetails @@ -2106,7 +2106,7 @@ Paul Marquess F. =head1 COPYRIGHT -Copyright (c) 2011 Paul Marquess. All rights reserved. +Copyright (c) 2011-2012 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/cpan/IO-Compress/lib/Compress/Zlib.pm b/cpan/IO-Compress/lib/Compress/Zlib.pm index 16f0cfa243..8d340290aa 100644 --- a/cpan/IO-Compress/lib/Compress/Zlib.pm +++ b/cpan/IO-Compress/lib/Compress/Zlib.pm @@ -1,23 +1,23 @@ package Compress::Zlib; -require 5.004 ; +require 5.006 ; require Exporter; use Carp ; use IO::Handle ; use Scalar::Util qw(dualvar); -use IO::Compress::Base::Common 2.045 ; -use Compress::Raw::Zlib 2.045 ; -use IO::Compress::Gzip 2.045 ; -use IO::Uncompress::Gunzip 2.045 ; +use IO::Compress::Base::Common 2.047 ; +use Compress::Raw::Zlib 2.047 ; +use IO::Compress::Gzip 2.047 ; +use IO::Uncompress::Gunzip 2.047 ; use strict ; use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = '2.045'; +$VERSION = '2.047'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -453,7 +453,7 @@ sub inflate package Compress::Zlib ; -use IO::Compress::Gzip::Constants 2.045 ; +use IO::Compress::Gzip::Constants 2.047 ; sub memGzip($) { @@ -578,7 +578,7 @@ sub memGunzip($) substr($$string, 0, 8) = ''; return _set_gzerr_undef(Z_DATA_ERROR()) unless $len == length($output) and - $crc == crc32($output); + $crc == Compress::Raw::Zlib::crc32($output); } else { @@ -1478,7 +1478,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 1995-2011 Paul Marquess. All rights reserved. +Copyright (c) 1995-2012 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/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm b/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm index 96ec70d16d..86a55b67b5 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.045 qw(:Status); +use IO::Compress::Base::Common 2.047 qw(:Status); -use Compress::Raw::Bzip2 2.045 ; +use Compress::Raw::Bzip2 2.047 ; our ($VERSION); -$VERSION = '2.045'; +$VERSION = '2.047'; 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 a0a03faa51..0efc862a8b 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm @@ -4,12 +4,18 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.045 qw(:Status); - -use Compress::Raw::Zlib 2.045 qw(Z_OK Z_FINISH MAX_WBITS) ; -our ($VERSION); - -$VERSION = '2.045'; +use IO::Compress::Base::Common 2.047 qw(:Status); +use Compress::Raw::Zlib 2.047 qw( !crc32 !adler32 ) ; + +require Exporter; +our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, @EXPORT, %DEFLATE_CONSTANTS); + +$VERSION = '2.047'; +@ISA = qw(Exporter); +@EXPORT_OK = @Compress::Raw::Zlib::DEFLATE_CONSTANTS; +%EXPORT_TAGS = %Compress::Raw::Zlib::DEFLATE_CONSTANTS; +@EXPORT = @EXPORT_OK; +%DEFLATE_CONSTANTS = %EXPORT_TAGS ; 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 da04ab6178..2abe738d3e 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.045 qw(:Status); +use IO::Compress::Base::Common 2.047 qw(:Status); our ($VERSION); -$VERSION = '2.045'; +$VERSION = '2.047'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Base.pm b/cpan/IO-Compress/lib/IO/Compress/Base.pm index adcfeccd55..f68c9375d0 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Base.pm @@ -1,12 +1,12 @@ package IO::Compress::Base ; -require 5.004 ; +require 5.006 ; use strict ; use warnings; -use IO::Compress::Base::Common 2.045 ; +use IO::Compress::Base::Common 2.047 ; use IO::File qw(SEEK_SET SEEK_END); ; use Scalar::Util qw(blessed readonly); @@ -20,7 +20,7 @@ use bytes; our (@ISA, $VERSION); @ISA = qw(Exporter IO::File); -$VERSION = '2.046'; +$VERSION = '2.047'; #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. @@ -703,16 +703,14 @@ sub beforePayload { } -sub newStream +sub _newStream { my $self = shift ; - + my $got = shift; + $self->_writeTrailer() or return 0 ; - my $got = $self->checkParams('newStream', *$self->{Got}, @_) - or return 0 ; - $self->ckParams($got) or $self->croakError("newStream: $self->{Error}"); @@ -731,6 +729,30 @@ sub newStream return 1 ; } +sub newStream +{ + my $self = shift ; + + my $got = $self->checkParams('newStream', *$self->{Got}, @_) + or return 0 ; + + $self->_newStream($got); + +# *$self->{Compress} = $self->mkComp($got) +# or return 0; +# +# *$self->{Header} = $self->mkHeader($got) ; +# $self->output(*$self->{Header} ) +# or return 0; +# +# *$self->{UnCompSize}->reset(); +# *$self->{CompSize}->reset(); +# +# $self->beforePayload(); +# +# return 1 ; +} + sub reset { my $self = shift ; @@ -989,7 +1011,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2011 Paul Marquess. All rights reserved. +Copyright (c) 2005-2012 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/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm b/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm index 0f1c63a234..de078986bd 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.045'; +$VERSION = '2.047'; @EXPORT = qw( isaFilehandle isaFilename isaScalar whatIsInput whatIsOutput @@ -519,6 +519,7 @@ sub ParseParameters #package IO::Compress::Base::Parameters; use strict; + use warnings; use Carp; diff --git a/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm b/cpan/IO-Compress/lib/IO/Compress/Bzip2.pm index 6c11ecb67c..bf38a0aca9 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.045 ; +use IO::Compress::Base 2.047 ; -use IO::Compress::Base::Common 2.045 qw(createSelfTiedObject); -use IO::Compress::Adapter::Bzip2 2.045 ; +use IO::Compress::Base::Common 2.047 qw(createSelfTiedObject); +use IO::Compress::Adapter::Bzip2 2.047 ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error); -$VERSION = '2.045'; +$VERSION = '2.047'; $Bzip2Error = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -51,7 +51,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.045 qw(:Parse); + use IO::Compress::Base::Common 2.047 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 1cf51b89ff..aeb184fd54 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Deflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Deflate.pm @@ -1,26 +1,29 @@ package IO::Compress::Deflate ; +require 5.006 ; + use strict ; use warnings; use bytes; require Exporter ; -use IO::Compress::RawDeflate 2.045 ; +use IO::Compress::RawDeflate 2.047 (); +use IO::Compress::Adapter::Deflate 2.047 ; -use Compress::Raw::Zlib 2.045 ; -use IO::Compress::Zlib::Constants 2.045 ; -use IO::Compress::Base::Common 2.045 qw(createSelfTiedObject); +use IO::Compress::Zlib::Constants 2.047 ; +use IO::Compress::Base::Common 2.047 qw(createSelfTiedObject); -our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError); +our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $DeflateError); -$VERSION = '2.045'; +$VERSION = '2.047'; $DeflateError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @EXPORT_OK = qw( $DeflateError deflate ) ; %EXPORT_TAGS = %IO::Compress::RawDeflate::DEFLATE_CONSTANTS ; + push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; Exporter::export_ok_tags('all'); @@ -921,7 +924,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2011 Paul Marquess. All rights reserved. +Copyright (c) 2005-2012 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/cpan/IO-Compress/lib/IO/Compress/FAQ.pod b/cpan/IO-Compress/lib/IO/Compress/FAQ.pod index 92be8563b8..d392ff2cc9 100644 --- a/cpan/IO-Compress/lib/IO/Compress/FAQ.pod +++ b/cpan/IO-Compress/lib/IO/Compress/FAQ.pod @@ -590,7 +590,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2011 Paul Marquess. All rights reserved. +Copyright (c) 2005-2012 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/cpan/IO-Compress/lib/IO/Compress/Gzip.pm b/cpan/IO-Compress/lib/IO/Compress/Gzip.pm index 97078a599e..9fecbaffcd 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Gzip.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Gzip.pm @@ -1,19 +1,19 @@ - package IO::Compress::Gzip ; -require 5.004 ; +require 5.006 ; use strict ; use warnings; use bytes; +require Exporter ; -use IO::Compress::RawDeflate 2.045 ; +use IO::Compress::RawDeflate 2.047 () ; +use IO::Compress::Adapter::Deflate 2.047 ; -use Compress::Raw::Zlib 2.045 ; -use IO::Compress::Base::Common 2.045 qw(:Status :Parse isaScalar createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.045 ; -use IO::Compress::Zlib::Extra 2.045 ; +use IO::Compress::Base::Common 2.047 qw(:Status :Parse isaScalar createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.047 ; +use IO::Compress::Zlib::Extra 2.047 ; BEGIN { @@ -23,16 +23,15 @@ BEGIN { *noUTF8 = sub {} } } -require Exporter ; +our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $GzipError); -our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError); - -$VERSION = '2.045'; +$VERSION = '2.047'; $GzipError = '' ; @ISA = qw(Exporter IO::Compress::RawDeflate); @EXPORT_OK = qw( $GzipError gzip ) ; %EXPORT_TAGS = %IO::Compress::RawDeflate::DEFLATE_CONSTANTS ; + push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; Exporter::export_ok_tags('all'); @@ -258,7 +257,7 @@ sub mkHeader } # HEADER CRC - $out .= pack("v", crc32($out) & 0x00FF ) if $param->value('HeaderCRC') ; + $out .= pack("v", Compress::Raw::Zlib::crc32($out) & 0x00FF ) if $param->value('HeaderCRC') ; noUTF8($out); @@ -1235,7 +1234,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2011 Paul Marquess. All rights reserved. +Copyright (c) 2005-2012 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/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm index 7695b2a0e1..98ea27a629 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.045'; +$VERSION = '2.047'; @ISA = qw(Exporter); diff --git a/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm b/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm index 487cd1bee4..9b86ef9c41 100644 --- a/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm +++ b/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm @@ -7,44 +7,23 @@ use warnings; use bytes; -use IO::Compress::Base 2.045 ; -use IO::Compress::Base::Common 2.045 qw(:Status createSelfTiedObject); -use IO::Compress::Adapter::Deflate 2.045 ; +use IO::Compress::Base 2.047 ; +use IO::Compress::Base::Common 2.047 qw(:Status createSelfTiedObject); +use IO::Compress::Adapter::Deflate 2.047 ; require Exporter ; - our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); -$VERSION = '2.045'; +$VERSION = '2.047'; $RawDeflateError = ''; @ISA = qw(Exporter IO::Compress::Base); @EXPORT_OK = qw( $RawDeflateError rawdeflate ) ; +push @EXPORT_OK, @IO::Compress::Adapter::Deflate::EXPORT_OK ; + +%EXPORT_TAGS = %IO::Compress::Adapter::Deflate::DEFLATE_CONSTANTS; -%EXPORT_TAGS = ( flush => [qw{ - Z_NO_FLUSH - Z_PARTIAL_FLUSH - Z_SYNC_FLUSH - Z_FULL_FLUSH - Z_FINISH - Z_BLOCK - }], - level => [qw{ - Z_NO_COMPRESSION - Z_BEST_SPEED - Z_BEST_COMPRESSION - Z_DEFAULT_COMPRESSION - }], - strategy => [qw{ - Z_FILTERED - Z_HUFFMAN_ONLY - Z_RLE - Z_FIXED - Z_DEFAULT_STRATEGY - }], - - ); { my %seen; @@ -60,7 +39,7 @@ $RawDeflateError = ''; %DEFLATE_CONSTANTS = %EXPORT_TAGS; -push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; +#push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; Exporter::export_ok_tags('all'); @@ -142,8 +121,8 @@ sub getZlibParams { my $self = shift ; - use IO::Compress::Base::Common 2.045 qw(:Parse); - use Compress::Raw::Zlib 2.045 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.047 qw(:Parse); + use Compress::Raw::Zlib 2.047 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); return ( @@ -1008,7 +987,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2011 Paul Marquess. All rights reserved. +Copyright (c) 2005-2012 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/cpan/IO-Compress/lib/IO/Compress/Zip.pm b/cpan/IO-Compress/lib/IO/Compress/Zip.pm index 0e4c957c39..f4ace79615 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zip.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zip.pm @@ -4,44 +4,45 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.045 qw(:Status MAX32 isGeMax32 isaScalar createSelfTiedObject); -use IO::Compress::RawDeflate 2.045 ; -use IO::Compress::Adapter::Deflate 2.045 ; -use IO::Compress::Adapter::Identity 2.045 ; -use IO::Compress::Zlib::Extra 2.045 ; -use IO::Compress::Zip::Constants 2.045 ; +use IO::Compress::Base::Common 2.047 qw(:Status MAX32 isGeMax32 isaScalar createSelfTiedObject); +use IO::Compress::RawDeflate 2.047 (); +use IO::Compress::Adapter::Deflate 2.047 ; +use IO::Compress::Adapter::Identity 2.047 ; +use IO::Compress::Zlib::Extra 2.047 ; +use IO::Compress::Zip::Constants 2.047 ; use File::Spec(); use Config; -use Compress::Raw::Zlib 2.045 qw(crc32) ; +use Compress::Raw::Zlib 2.047 (); BEGIN { eval { require IO::Compress::Adapter::Bzip2 ; - import IO::Compress::Adapter::Bzip2 2.045 ; + import IO::Compress::Adapter::Bzip2 2.047 ; require IO::Compress::Bzip2 ; - import IO::Compress::Bzip2 2.045 ; + import IO::Compress::Bzip2 2.047 ; } ; eval { require IO::Compress::Adapter::Lzma ; - import IO::Compress::Adapter::Lzma 2.045 ; + import IO::Compress::Adapter::Lzma 2.047 ; require IO::Compress::Lzma ; - import IO::Compress::Lzma 2.045 ; + import IO::Compress::Lzma 2.047 ; } ; } require Exporter ; -our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError); +our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $ZipError); -$VERSION = '2.046'; +$VERSION = '2.047'; $ZipError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @EXPORT_OK = qw( $ZipError zip ) ; %EXPORT_TAGS = %IO::Compress::RawDeflate::DEFLATE_CONSTANTS ; + push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; $EXPORT_TAGS{zip_method} = [qw( ZIP_CM_STORE ZIP_CM_DEFLATE ZIP_CM_BZIP2 ZIP_CM_LZMA)]; @@ -64,6 +65,25 @@ sub zip return $obj->_def(@_); } +sub isMethodAvailable +{ + my $method = shift; + + # Store & Deflate are always available + return 1 + if $method == ZIP_CM_STORE || $method == ZIP_CM_DEFLATE ; + + return 1 + if $method == ZIP_CM_BZIP2 and + defined $IO::Compress::Adapter::Bzip2::VERSION; + + return 1 + if $method == ZIP_CM_LZMA and + defined $IO::Compress::Adapter::Lzma::VERSION; + + return 0; +} + sub beforePayload { my $self = shift ; @@ -77,9 +97,9 @@ sub beforePayload *$self->{FH}->seek($sparse, IO::Handle::SEEK_CUR); - *$self->{ZipData}{CRC32} = crc32($NULLS, *$self->{ZipData}{CRC32}) + *$self->{ZipData}{CRC32} = Compress::Raw::Zlib::crc32($NULLS, *$self->{ZipData}{CRC32}) for 1 .. int $sparse / $inc; - *$self->{ZipData}{CRC32} = crc32(substr($NULLS, 0, $sparse % $inc), + *$self->{ZipData}{CRC32} = Compress::Raw::Zlib::crc32(substr($NULLS, 0, $sparse % $inc), *$self->{ZipData}{CRC32}) if $sparse % $inc; } @@ -97,7 +117,7 @@ sub mkComp $got->value('Level'), $got->value('Strategy') ); - *$self->{ZipData}{CRC32} = crc32(undef); + *$self->{ZipData}{CRC32} = Compress::Raw::Zlib::crc32(undef); } elsif (*$self->{ZipData}{Method} == ZIP_CM_DEFLATE) { ($obj, $errstr, $errno) = IO::Compress::Adapter::Deflate::mkCompObject( @@ -113,13 +133,13 @@ sub mkComp $got->value('WorkFactor'), $got->value('Verbosity') ); - *$self->{ZipData}{CRC32} = crc32(undef); + *$self->{ZipData}{CRC32} = Compress::Raw::Zlib::crc32(undef); } elsif (*$self->{ZipData}{Method} == ZIP_CM_LZMA) { ($obj, $errstr, $errno) = IO::Compress::Adapter::Lzma::mkRawZipCompObject($got->value('Preset'), $got->value('Extreme'), ); - *$self->{ZipData}{CRC32} = crc32(undef); + *$self->{ZipData}{CRC32} = Compress::Raw::Zlib::crc32(undef); } return $self->saveErrorString(undef, $errstr, $errno) @@ -154,7 +174,7 @@ sub filterUncompressed *$self->{ZipData}{CRC32} = *$self->{Compress}->crc32(); } else { - *$self->{ZipData}{CRC32} = crc32(${$_[0]}, *$self->{ZipData}{CRC32}); + *$self->{ZipData}{CRC32} = Compress::Raw::Zlib::crc32(${$_[0]}, *$self->{ZipData}{CRC32}); } } @@ -246,6 +266,7 @@ sub mkHeader my $extFileAttr = 0 ; # This code assumes Unix. + # TODO - revisit this $extFileAttr = 0100644 << 16 if $osCode == ZIP_OS_CODE_UNIX ; @@ -259,7 +280,7 @@ sub mkHeader } if (! $param->value('Minimal')) { - if (defined $param->value('exTime')) + if ($param->parsed('MTime')) { $extra .= mkExtendedTime($param->value('MTime'), $param->value('ATime'), @@ -305,10 +326,10 @@ sub mkHeader #$gpFlag |= ZIP_GP_FLAG_LANGUAGE_ENCODING #if $param->value('UTF8') && length($filename) + length($comment); - my $version = $ZIP_CM_MIN_VERSIONS{$method}; $version = ZIP64_MIN_VERSION if ZIP64_MIN_VERSION > $version && *$self->{ZipData}{Zip64}; + my $madeBy = ($param->value('OS_Code') << 8) + $version; my $extract = $version; @@ -643,8 +664,8 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.045 qw(:Parse); - use Compress::Raw::Zlib 2.045 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.047 qw(:Parse); + use Compress::Raw::Zlib 2.047 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); my @Bzip2 = (); @@ -661,7 +682,7 @@ sub getExtraParams # # Zip header fields 'Minimal' => [0, 1, Parse_boolean, 0], - 'Zip64' => [0, 1, Parse_any, 0], + 'Zip64' => [0, 1, Parse_boolean, 0], 'Comment' => [0, 1, Parse_any, ''], 'ZipComment'=> [0, 1, Parse_any, ''], 'Name' => [0, 1, Parse_any, ''], @@ -713,11 +734,23 @@ sub getFileInfo return ; } - my ($mode, $uid, $gid, $atime, $mtime, $ctime) - = (stat($filename))[2, 4,5, 8,9,10] ; + my ($mode, $uid, $gid, $size, $atime, $mtime, $ctime) ; + if ( $params->parsed('StoreLinks') ) + { + ($mode, $uid, $gid, $size, $atime, $mtime, $ctime) + = (lstat($filename))[2, 4,5,7, 8,9,10] ; + } + else + { + ($mode, $uid, $gid, $size, $atime, $mtime, $ctime) + = (stat($filename))[2, 4,5,7, 8,9,10] ; + } + + $params->value(TextFlag => -T $filename ) + if ! $params->parsed('TextFlag'); $params->value(Zip64 => 1) - if isGeMax32 -s $filename ; + if isGeMax32 $size ; $params->value('Name' => $filename) if ! $params->parsed('Name') ; @@ -730,7 +763,7 @@ sub getFileInfo $params->value('MTime' => $mtime) ; $params->value('ATime' => $atime) ; $params->value('CTime' => undef) ; # No Creation time - $params->value("exTime", [$mtime, $atime, undef]); + # TODO - see if can fillout creation time on non-Unix } # NOTE - Unix specific code alert @@ -807,6 +840,7 @@ sub mkUnixNExtra sub _unixToDosTime # Archive::Zip::Member { my $time_t = shift; + # TODO - add something to cope with unix time < 1980 my ( $sec, $min, $hour, $mday, $mon, $year ) = localtime($time_t); my $dt = 0; @@ -960,10 +994,10 @@ See L for more details. If the C<$input> parameter is any other type, C will be returned. In addition, if C<$input> is a simple filename, the default values for -the C, C