diff options
author | paul <paul@paul-desktop.(none)> | 2010-01-09 18:32:51 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-01-10 15:03:47 +0100 |
commit | 9b5fd1d4b111acc07bae6fc8d66a179438294985 (patch) | |
tree | 1be666b79633361cc42c652f1509953e525b6814 /cpan/IO-Compress | |
parent | b4222fa9a30f89a491b9910b750d8aa7895a0e77 (diff) | |
download | perl-9b5fd1d4b111acc07bae6fc8d66a179438294985.tar.gz |
2.024
Diffstat (limited to 'cpan/IO-Compress')
36 files changed, 843 insertions, 325 deletions
diff --git a/cpan/IO-Compress/Changes b/cpan/IO-Compress/Changes index ef306447b6..c98bef1d5e 100644 --- a/cpan/IO-Compress/Changes +++ b/cpan/IO-Compress/Changes @@ -1,6 +1,25 @@ CHANGES ------- + 2.024 7 January 2010 + + * Compress::Zlib + Get memGunzip & memGzip to set $gzerrno + [RT# 47283] + + * Compress::Zlib + Export memGunzip, memGzip and zlib_version on demand + [RT# 52992] + + * examples/io/anycat + This sample was using IO::Uncompress::AnyInflate. Much better to + use IO::Uncompress::AnyUncompress. + + 2.023 9 November 2009 + + * IO::Compress::AnyUncompress + Added support for lzma_alone & xz. + 2.022 9 October 2009 * IO::Compress - Makefile.PL diff --git a/cpan/IO-Compress/Makefile.PL b/cpan/IO-Compress/Makefile.PL index 018e27bdc8..00902f676b 100644 --- a/cpan/IO-Compress/Makefile.PL +++ b/cpan/IO-Compress/Makefile.PL @@ -3,7 +3,7 @@ use strict ; require 5.004 ; -$::VERSION = '2.021' ; +$::VERSION = '2.024' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; diff --git a/cpan/IO-Compress/README b/cpan/IO-Compress/README index 8da9fbfbaa..3974cd4e39 100644 --- a/cpan/IO-Compress/README +++ b/cpan/IO-Compress/README @@ -1,11 +1,11 @@ - IO-Compress + IO-Compress - Version 2.022 + Version 2.024 - 9th October 2009 + 7th January 2010 - Copyright (c) 1995-2009 Paul Marquess. All rights reserved. + Copyright (c) 1995-2010 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.021" ; + $VERSION = "2.024" ; 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/examples/io/anycat b/cpan/IO-Compress/examples/io/anycat index 9db9c41faf..b7f7001b5e 100755 --- a/cpan/IO-Compress/examples/io/anycat +++ b/cpan/IO-Compress/examples/io/anycat @@ -3,15 +3,15 @@ use strict ; use warnings ; -use IO::Uncompress::AnyInflate qw( anyinflate $AnyInflateError ); +use IO::Uncompress::AnyUncompress qw( anyuncompress $AnyUncompressError ); @ARGV = '-' unless @ARGV ; foreach my $file (@ARGV) { - anyinflate $file => '-', + anyuncompress $file => '-', Transparent => 1, Strict => 0, - or die "Cannot uncompress '$file': $AnyInflateError\n" ; + or die "Cannot uncompress '$file': $AnyUncompressError\n" ; } diff --git a/cpan/IO-Compress/lib/Compress/Zlib.pm b/cpan/IO-Compress/lib/Compress/Zlib.pm index 604227c3a1..9424df63b8 100644 --- a/cpan/IO-Compress/lib/Compress/Zlib.pm +++ b/cpan/IO-Compress/lib/Compress/Zlib.pm @@ -8,17 +8,17 @@ use Carp ; use IO::Handle ; use Scalar::Util qw(dualvar); -use IO::Compress::Base::Common 2.021 ; -use Compress::Raw::Zlib 2.021 ; -use IO::Compress::Gzip 2.021 ; -use IO::Uncompress::Gunzip 2.021 ; +use IO::Compress::Base::Common 2.024 ; +use Compress::Raw::Zlib 2.024 ; +use IO::Compress::Gzip 2.024 ; +use IO::Uncompress::Gunzip 2.024 ; use strict ; use warnings ; use bytes ; -our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); +our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $AUTOLOAD); -$VERSION = '2.022'; +$VERSION = '2.024'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -36,6 +36,11 @@ $VERSION = eval $VERSION; push @EXPORT, @Compress::Raw::Zlib::EXPORT ; +@EXPORT_OK = qw(memGunzip memGzip zlib_version); +%EXPORT_TAGS = ( + ALL => \@EXPORT +); + BEGIN { *zlib_version = \&Compress::Raw::Zlib::zlib_version; @@ -88,6 +93,11 @@ sub _set_gzerr return $value ; } +sub _set_gzerr_undef +{ + _set_gzerr(@_); + return undef; +} sub _save_gzerr { my $gz = shift ; @@ -452,7 +462,7 @@ sub inflate package Compress::Zlib ; -use IO::Compress::Gzip::Constants 2.021 ; +use IO::Compress::Gzip::Constants 2.024 ; sub memGzip($) { @@ -464,13 +474,16 @@ sub memGzip($) $] >= 5.008 and (utf8::downgrade($$string, 1) or croak "Wide character in memGzip"); - IO::Compress::Gzip::gzip($string, \$out, Minimal => 1) - or return undef ; + _set_gzerr(0); + if ( ! IO::Compress::Gzip::gzip($string, \$out, Minimal => 1) ) + { + $Compress::Zlib::gzerrno = $IO::Compress::Gzip::GzipError; + return undef ; + } return $out; } - sub _removeGzipHeader($) { my $string = shift ; @@ -529,6 +542,12 @@ sub _removeGzipHeader($) return Z_OK(); } +sub _ret_gun_error +{ + $Compress::Zlib::gzerrno = $IO::Uncompress::Gunzip::GunzipError; + return undef; +} + sub memGunzip($) { @@ -538,25 +557,35 @@ sub memGunzip($) $] >= 5.008 and (utf8::downgrade($$string, 1) or croak "Wide character in memGunzip"); - _removeGzipHeader($string) == Z_OK() - or return undef; + _set_gzerr(0); + + my $status = _removeGzipHeader($string) ; + $status == Z_OK() + or return _set_gzerr_undef($status); my $bufsize = length $$string > 4096 ? length $$string : 4096 ; my $x = new Compress::Raw::Zlib::Inflate({-WindowBits => - MAX_WBITS(), -Bufsize => $bufsize}) - or return undef; + or return _ret_gun_error(); my $output = "" ; - my $status = $x->inflate($string, $output); - return undef - unless $status == Z_STREAM_END(); + $status = $x->inflate($string, $output); + + if ( $status == Z_OK() ) + { + _set_gzerr(Z_DATA_ERROR()); + return undef; + } + + return _ret_gun_error() + if ($status != Z_STREAM_END()); if (length $$string >= 8) { my ($crc, $len) = unpack ("VV", substr($$string, 0, 8)); substr($$string, 0, 8) = ''; - return undef + return _set_gzerr_undef(Z_DATA_ERROR()) unless $len == length($output) and $crc == crc32($output); } @@ -564,6 +593,7 @@ sub memGunzip($) { $$string = ''; } + return $output; } @@ -972,10 +1002,11 @@ standard output. This function is used to create an in-memory gzip file with the minimum possible gzip header (exactly 10 bytes). - $dest = Compress::Zlib::memGzip($buffer) ; + $dest = Compress::Zlib::memGzip($buffer) + or die "Cannot compress: $gzerrno\n"; -If successful, it returns the in-memory gzip file, otherwise it returns -undef. +If successful, it returns the in-memory gzip file. Otherwise it returns +C<undef> and the C<$gzerrno> variable will store the zlib error code. The C<$buffer> parameter can either be a scalar or a scalar reference. @@ -986,10 +1017,12 @@ carry out in-memory gzip compression. This function is used to uncompress an in-memory gzip file. - $dest = Compress::Zlib::memGunzip($buffer) ; + $dest = Compress::Zlib::memGunzip($buffer) + or die "Cannot uncomprss: $gzerrno\n"; -If successful, it returns the uncompressed gzip file, otherwise it -returns undef. +If successful, it returns the uncompressed gzip file. Otherwise it +returns C<undef> and the C<$gzerrno> variable will store the zlib error +code. The C<$buffer> parameter can either be a scalar or a scalar reference. The contents of the C<$buffer> parameter are destroyed after calling this function. @@ -1423,7 +1456,7 @@ of I<Compress::Zlib>. =head1 SEE ALSO -L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -1454,7 +1487,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 1995-2009 Paul Marquess. All rights reserved. +Copyright (c) 1995-2010 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 103a0452b6..3e2e89f8e1 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.021 qw(:Status); +use IO::Compress::Base::Common 2.024 qw(:Status); #use Compress::Bzip2 ; -use Compress::Raw::Bzip2 2.021 ; +use Compress::Raw::Bzip2 2.024 ; our ($VERSION); -$VERSION = '2.022'; +$VERSION = '2.024'; 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 ac8f0364f9..f23a9819c6 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.021 qw(:Status); +use IO::Compress::Base::Common 2.024 qw(:Status); -use Compress::Raw::Zlib 2.021 qw(Z_OK Z_FINISH MAX_WBITS) ; +use Compress::Raw::Zlib 2.024 qw(Z_OK Z_FINISH MAX_WBITS) ; our ($VERSION); -$VERSION = '2.022'; +$VERSION = '2.024'; 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 e83542fca7..16f14d8e7f 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.021 qw(:Status); +use IO::Compress::Base::Common 2.024 qw(:Status); our ($VERSION); -$VERSION = '2.022'; +$VERSION = '2.024'; sub mkCompObject { diff --git a/cpan/IO-Compress/lib/IO/Compress/Base.pm b/cpan/IO-Compress/lib/IO/Compress/Base.pm index bdd8d79513..5a20f60007 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Base.pm @@ -6,7 +6,7 @@ require 5.004 ; use strict ; use warnings; -use IO::Compress::Base::Common 2.021 ; +use IO::Compress::Base::Common 2.024 ; 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.022'; +$VERSION = '2.024'; #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. @@ -956,7 +956,7 @@ purpose if to to be sub-classed by IO::Compress modules. =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -974,7 +974,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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 26af4f87b0..4f8b4dadc3 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.022'; +$VERSION = '2.024'; @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 28725c64a8..2a85ef55b1 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.021 ; +use IO::Compress::Base 2.024 ; -use IO::Compress::Base::Common 2.021 qw(createSelfTiedObject); -use IO::Compress::Adapter::Bzip2 2.021 ; +use IO::Compress::Base::Common 2.024 qw(createSelfTiedObject); +use IO::Compress::Adapter::Bzip2 2.024 ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error); -$VERSION = '2.022'; +$VERSION = '2.024'; $Bzip2Error = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -51,7 +51,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 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 2e1a19fe07..0f46e59d3a 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.021 ; +use IO::Compress::RawDeflate 2.024 ; -use Compress::Raw::Zlib 2.021 ; -use IO::Compress::Zlib::Constants 2.021 ; -use IO::Compress::Base::Common 2.021 qw(createSelfTiedObject); +use Compress::Raw::Zlib 2.024 ; +use IO::Compress::Zlib::Constants 2.024 ; +use IO::Compress::Base::Common 2.024 qw(createSelfTiedObject); our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError); -$VERSION = '2.022'; +$VERSION = '2.024'; $DeflateError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -364,7 +364,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C<Append> is enabled, all compressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +compressed data is written to it. + +=item * A Filename + +If C<Append> is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any compressed +data is written to it. + +=item * A Filehandle + +If C<Append> is enabled, the filehandle will be positioned to the end of +the file via a call to C<seek> before any compressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C<Append> is specified, and set to true, it will I<append> all compressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any compressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all compressed data will be appened to +the existing buffer. + +Conversely when C<Append> is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any compressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any compressed data is output. + +Defaults to 0. =back @@ -493,7 +534,7 @@ The behaviour of this option is dependent on the type of C<$output>. =item * A Buffer If C<$output> is a buffer and C<Append> is enabled, all compressed data -will be append to the end if C<$output>. Otherwise C<$output> will be +will be append to the end of C<$output>. Otherwise C<$output> will be cleared before any data is written to it. =item * A Filename @@ -851,7 +892,7 @@ See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -882,7 +923,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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 f2e60f6557..1978b91b28 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.021 ; +use IO::Compress::RawDeflate 2.024 ; -use Compress::Raw::Zlib 2.021 ; -use IO::Compress::Base::Common 2.021 qw(:Status :Parse createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.021 ; -use IO::Compress::Zlib::Extra 2.021 ; +use Compress::Raw::Zlib 2.024 ; +use IO::Compress::Base::Common 2.024 qw(:Status :Parse createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.024 ; +use IO::Compress::Zlib::Extra 2.024 ; BEGIN { @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError); -$VERSION = '2.022'; +$VERSION = '2.024'; $GzipError = '' ; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -482,7 +482,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C<Append> is enabled, all compressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +compressed data is written to it. + +=item * A Filename + +If C<Append> is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any compressed +data is written to it. + +=item * A Filehandle + +If C<Append> is enabled, the filehandle will be positioned to the end of +the file via a call to C<seek> before any compressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C<Append> is specified, and set to true, it will I<append> all compressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any compressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all compressed data will be appened to +the existing buffer. + +Conversely when C<Append> is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any compressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any compressed data is output. + +Defaults to 0. =back @@ -611,7 +652,7 @@ The behaviour of this option is dependent on the type of C<$output>. =item * A Buffer If C<$output> is a buffer and C<Append> is enabled, all compressed data -will be append to the end if C<$output>. Otherwise C<$output> will be +will be append to the end of C<$output>. Otherwise C<$output> will be cleared before any data is written to it. =item * A Filename @@ -1163,7 +1204,7 @@ See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -1194,7 +1235,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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 095668e4fb..8504330d18 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.022'; +$VERSION = '2.024'; @ISA = qw(Exporter); diff --git a/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm b/cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm index 02a8cda27a..b97b51c050 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.021 ; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); -use IO::Compress::Adapter::Deflate 2.021 ; +use IO::Compress::Base 2.024 ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); +use IO::Compress::Adapter::Deflate 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); -$VERSION = '2.022'; +$VERSION = '2.024'; $RawDeflateError = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -142,8 +142,8 @@ sub getZlibParams { my $self = shift ; - use IO::Compress::Base::Common 2.021 qw(:Parse); - use Compress::Raw::Zlib 2.021 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.024 qw(:Parse); + use Compress::Raw::Zlib 2.024 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); return ( @@ -451,7 +451,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C<Append> is enabled, all compressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +compressed data is written to it. + +=item * A Filename + +If C<Append> is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any compressed +data is written to it. + +=item * A Filehandle + +If C<Append> is enabled, the filehandle will be positioned to the end of +the file via a call to C<seek> before any compressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C<Append> is specified, and set to true, it will I<append> all compressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any compressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all compressed data will be appened to +the existing buffer. + +Conversely when C<Append> is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any compressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any compressed data is output. + +Defaults to 0. =back @@ -580,7 +621,7 @@ The behaviour of this option is dependent on the type of C<$output>. =item * A Buffer If C<$output> is a buffer and C<Append> is enabled, all compressed data -will be append to the end if C<$output>. Otherwise C<$output> will be +will be append to the end of C<$output>. Otherwise C<$output> will be cleared before any data is written to it. =item * A Filename @@ -938,7 +979,7 @@ See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -969,7 +1010,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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 d6e6167b95..5e37d78f97 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zip.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zip.pm @@ -4,27 +4,27 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); -use IO::Compress::RawDeflate 2.021 ; -use IO::Compress::Adapter::Deflate 2.021 ; -use IO::Compress::Adapter::Identity 2.021 ; -use IO::Compress::Zlib::Extra 2.021 ; -use IO::Compress::Zip::Constants 2.021 ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); +use IO::Compress::RawDeflate 2.024 ; +use IO::Compress::Adapter::Deflate 2.024 ; +use IO::Compress::Adapter::Identity 2.024 ; +use IO::Compress::Zlib::Extra 2.024 ; +use IO::Compress::Zip::Constants 2.024 ; -use Compress::Raw::Zlib 2.021 qw(crc32) ; +use Compress::Raw::Zlib 2.024 qw(crc32) ; BEGIN { eval { require IO::Compress::Adapter::Bzip2 ; - import IO::Compress::Adapter::Bzip2 2.021 ; + import IO::Compress::Adapter::Bzip2 2.024 ; require IO::Compress::Bzip2 ; - import IO::Compress::Bzip2 2.021 ; - } ; - eval { require IO::Compress::Adapter::Lzma ; - import IO::Compress::Adapter::Lzma 2.020 ; - require IO::Compress::Lzma ; - import IO::Compress::Lzma 2.020 ; + import IO::Compress::Bzip2 2.024 ; } ; +# eval { require IO::Compress::Adapter::Lzma ; +# import IO::Compress::Adapter::Lzma 2.020 ; +# require IO::Compress::Lzma ; +# import IO::Compress::Lzma 2.024 ; +# } ; } @@ -32,7 +32,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError); -$VERSION = '2.022'; +$VERSION = '2.024'; $ZipError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -89,10 +89,10 @@ sub mkComp ); *$self->{ZipData}{CRC32} = crc32(undef); } - elsif (*$self->{ZipData}{Method} == ZIP_CM_LZMA) { - ($obj, $errstr, $errno) = IO::Compress::Adapter::Lzma::mkCompObject(); - *$self->{ZipData}{CRC32} = crc32(undef); - } +# elsif (*$self->{ZipData}{Method} == ZIP_CM_LZMA) { +# ($obj, $errstr, $errno) = IO::Compress::Adapter::Lzma::mkCompObject(); +# *$self->{ZipData}{CRC32} = crc32(undef); +# } return $self->saveErrorString(undef, $errstr, $errno) if ! defined $obj; @@ -475,8 +475,9 @@ sub ckParams ! defined $IO::Compress::Adapter::Bzip2::VERSION; return $self->saveErrorString(undef, "Lzma not available") - if $method == ZIP_CM_LZMA and - ! defined $IO::Compress::Adapter::Lzma::VERSION; + if $method == ZIP_CM_LZMA ; + #and + #! defined $IO::Compress::Adapter::Lzma::VERSION; *$self->{ZipData}{Method} = $method; @@ -512,8 +513,8 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.021 qw(:Parse); - use Compress::Raw::Zlib 2.021 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.024 qw(:Parse); + use Compress::Raw::Zlib 2.024 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); my @Bzip2 = (); @@ -859,7 +860,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C<Append> is enabled, all compressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +compressed data is written to it. + +=item * A Filename + +If C<Append> is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any compressed +data is written to it. + +=item * A Filehandle + +If C<Append> is enabled, the filehandle will be positioned to the end of +the file via a call to C<seek> before any compressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C<Append> is specified, and set to true, it will I<append> all compressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any compressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all compressed data will be appened to +the existing buffer. + +Conversely when C<Append> is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any compressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any compressed data is output. + +Defaults to 0. =back @@ -988,7 +1030,7 @@ The behaviour of this option is dependent on the type of C<$output>. =item * A Buffer If C<$output> is a buffer and C<Append> is enabled, all compressed data -will be append to the end if C<$output>. Otherwise C<$output> will be +will be append to the end of C<$output>. Otherwise C<$output> will be cleared before any data is written to it. =item * A Filename @@ -1532,7 +1574,7 @@ See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -1563,7 +1605,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/Constants.pm b/cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm index a554d49df6..c8cb95342a 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.022'; +$VERSION = '2.024'; @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 6b935ffc11..10fcf345f6 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.022'; +$VERSION = '2.024'; @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 0c88017a63..6812bb409d 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.022'; +$VERSION = '2.024'; -use IO::Compress::Gzip::Constants 2.021 ; +use IO::Compress::Gzip::Constants 2.024 ; 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 796aadb416..98677e3c09 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.021 qw(:Status); +use IO::Compress::Base::Common 2.024 qw(:Status); -use Compress::Raw::Bzip2 2.021 ; +use Compress::Raw::Bzip2 2.024 ; our ($VERSION, @ISA); -$VERSION = '2.022'; +$VERSION = '2.024'; 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 834eb5d230..27de6e0f36 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.021 qw(:Status); +use IO::Compress::Base::Common 2.024 qw(:Status); our ($VERSION); -$VERSION = '2.022'; +$VERSION = '2.024'; -use Compress::Raw::Zlib 2.021 (); +use Compress::Raw::Zlib 2.024 (); 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 5c67c1b6a8..aac1e413ff 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.021 qw(:Status); -use Compress::Raw::Zlib 2.021 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); +use IO::Compress::Base::Common 2.024 qw(:Status); +use Compress::Raw::Zlib 2.024 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); our ($VERSION); -$VERSION = '2.022'; +$VERSION = '2.024'; diff --git a/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm index 900feda477..68038f5d37 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.021 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.024 qw(createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.021 (); +use IO::Uncompress::Adapter::Inflate 2.024 (); -use IO::Uncompress::Base 2.021 ; -use IO::Uncompress::Gunzip 2.021 ; -use IO::Uncompress::Inflate 2.021 ; -use IO::Uncompress::RawInflate 2.021 ; -use IO::Uncompress::Unzip 2.021 ; +use IO::Uncompress::Base 2.024 ; +use IO::Uncompress::Gunzip 2.024 ; +use IO::Uncompress::Inflate 2.024 ; +use IO::Uncompress::RawInflate 2.024 ; +use IO::Uncompress::Unzip 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError); -$VERSION = '2.022'; +$VERSION = '2.024'; $AnyInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -48,7 +48,7 @@ sub anyinflate sub getExtraParams { - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ; } @@ -341,7 +341,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C<Append> is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C<Append> is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C<Append> is enabled, the filehandle will be positioned to the end of +the file via a call to C<seek> before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C<Append> is specified, and set to true, it will I<append> all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C<Append> is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -908,7 +949,7 @@ See L<IO::Uncompress::AnyInflate::FAQ|IO::Uncompress::AnyInflate::FAQ/"Compresse =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -939,7 +980,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/Uncompress/AnyUncompress.pm b/cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm index c4406e55d5..5984921e25 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.021 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.024 qw(createSelfTiedObject); -use IO::Uncompress::Base 2.021 ; +use IO::Uncompress::Base 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError); -$VERSION = '2.022'; +$VERSION = '2.024'; $AnyUncompressError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -27,22 +27,22 @@ Exporter::export_ok_tags('all'); BEGIN { - eval ' use IO::Uncompress::Adapter::Inflate 2.021 ;'; - eval ' use IO::Uncompress::Adapter::Bunzip2 2.021 ;'; - eval ' use IO::Uncompress::Adapter::LZO 2.021 ;'; - eval ' use IO::Uncompress::Adapter::Lzf 2.021 ;'; - #eval ' use IO::Uncompress::Adapter::UnLzma 2.020 ;'; - #eval ' use IO::Uncompress::Adapter::UnXz 2.020 ;'; - - eval ' use IO::Uncompress::Bunzip2 2.021 ;'; - eval ' use IO::Uncompress::UnLzop 2.021 ;'; - eval ' use IO::Uncompress::Gunzip 2.021 ;'; - eval ' use IO::Uncompress::Inflate 2.021 ;'; - eval ' use IO::Uncompress::RawInflate 2.021 ;'; - eval ' use IO::Uncompress::Unzip 2.021 ;'; - eval ' use IO::Uncompress::UnLzf 2.021 ;'; - #eval ' use IO::Uncompress::UnLzma 2.018 ;'; - #eval ' use IO::Uncompress::UnXz 2.018 ;'; + eval ' use IO::Uncompress::Adapter::Inflate 2.024 ;'; + eval ' use IO::Uncompress::Adapter::Bunzip2 2.024 ;'; + eval ' use IO::Uncompress::Adapter::LZO 2.024 ;'; + eval ' use IO::Uncompress::Adapter::Lzf 2.024 ;'; + eval ' use IO::Uncompress::Adapter::UnLzma 2.020 ;'; + eval ' use IO::Uncompress::Adapter::UnXz 2.020 ;'; + + eval ' use IO::Uncompress::Bunzip2 2.024 ;'; + eval ' use IO::Uncompress::UnLzop 2.024 ;'; + eval ' use IO::Uncompress::Gunzip 2.024 ;'; + eval ' use IO::Uncompress::Inflate 2.024 ;'; + eval ' use IO::Uncompress::RawInflate 2.024 ;'; + eval ' use IO::Uncompress::Unzip 2.024 ;'; + eval ' use IO::Uncompress::UnLzf 2.024 ;'; + eval ' use IO::Uncompress::UnLzma 2.024 ;'; + eval ' use IO::Uncompress::UnXz 2.024 ;'; } sub new @@ -60,7 +60,7 @@ sub anyuncompress sub getExtraParams { - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] , 'UnLzma' => [1, 1, Parse_boolean, 0] ) ; } @@ -108,39 +108,40 @@ sub mkUncomp } } -# if (defined $IO::Uncompress::UnLzma::VERSION && $got->value('UnLzma')) -# { -# my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnLzma::mkUncompObject(); -# -# return $self->saveErrorString(undef, $errstr, $errno) -# if ! defined $obj; -# -# *$self->{Uncomp} = $obj; -# -# my @possible = qw( UnLzma ); -# #unshift @possible, 'RawInflate' -# # if $got->value('RawInflate'); -# -# if ( *$self->{Info} = $self->ckMagic( @possible )) -# { -# return 1; -# } -# } -# -# if (defined $IO::Uncompress::UnXz::VERSION and -# $magic = $self->ckMagic('UnXz')) { -# *$self->{Info} = $self->readHeader($magic) -# or return undef ; -# -# my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnXz::mkUncompObject(); -# -# return $self->saveErrorString(undef, $errstr, $errno) -# if ! defined $obj; -# -# *$self->{Uncomp} = $obj; -# -# return 1; -# } + if (defined $IO::Uncompress::UnLzma::VERSION && $got->value('UnLzma')) + { + my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnLzma::mkUncompObject(); + + return $self->saveErrorString(undef, $errstr, $errno) + if ! defined $obj; + + *$self->{Uncomp} = $obj; + + my @possible = qw( UnLzma ); + #unshift @possible, 'RawInflate' + # if $got->value('RawInflate'); + + if ( *$self->{Info} = $self->ckMagic( @possible )) + { + return 1; + } + } + + if (defined $IO::Uncompress::UnXz::VERSION and + $magic = $self->ckMagic('UnXz')) { + *$self->{Info} = $self->readHeader($magic) + or return undef ; + + my ($obj, $errstr, $errno) = + IO::Uncompress::Adapter::UnXz::mkUncompObject(); + + return $self->saveErrorString(undef, $errstr, $errno) + if ! defined $obj; + + *$self->{Uncomp} = $obj; + + return 1; + } if (defined $IO::Uncompress::Bunzip2::VERSION and $magic = $self->ckMagic('Bunzip2')) { @@ -295,6 +296,10 @@ The formats supported are: =item lzf +=item lzma + +=item xz + =back The module will auto-detect which, if any, of the supported @@ -445,7 +450,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C<Append> is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C<Append> is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C<Append> is enabled, the filehandle will be positioned to the end of +the file via a call to C<seek> before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C<Append> is specified, and set to true, it will I<append> all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C<Append> is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -681,6 +727,17 @@ prone and can result is false positives. Defaults to 0. +=item C<< UnLzma => 0|1 >> + +When auto-detecting the compressed format, try to test for lzma_alone +content using the C<IO::Uncompress::UnLzma> module. + +The reason this is not default behaviour is because lzma_alone content can +only be detected by attempting to uncompress it. This process is error +prone and can result is false positives. + +Defaults to 0. + =back =head2 Examples @@ -936,7 +993,7 @@ Same as doing this =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -954,7 +1011,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/Uncompress/Base.pm b/cpan/IO-Compress/lib/IO/Uncompress/Base.pm index eccff87b2c..33f2ac2375 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Base.pm @@ -9,12 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter IO::File); -$VERSION = '2.022'; +$VERSION = '2.024'; use constant G_EOF => 0 ; use constant G_ERR => -1 ; -use IO::Compress::Base::Common 2.021 ; +use IO::Compress::Base::Common 2.024 ; #use Parse::Parameters ; use IO::File ; @@ -1449,7 +1449,7 @@ purpose if to to be sub-classed by IO::Unompress modules. =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -1467,7 +1467,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/Uncompress/Bunzip2.pm b/cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm index 22cf65d450..b3988c4185 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.021 qw(:Status createSelfTiedObject); +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); -use IO::Uncompress::Base 2.021 ; -use IO::Uncompress::Adapter::Bunzip2 2.021 ; +use IO::Uncompress::Base 2.024 ; +use IO::Uncompress::Adapter::Bunzip2 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error); -$VERSION = '2.022'; +$VERSION = '2.024'; $Bunzip2Error = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -40,7 +40,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 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 41b6d3d4f6..f3e4e6561f 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.021 ; +use IO::Uncompress::RawInflate 2.024 ; -use Compress::Raw::Zlib 2.021 qw( crc32 ) ; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.021 ; -use IO::Compress::Zlib::Extra 2.021 ; +use Compress::Raw::Zlib 2.024 qw( crc32 ) ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.024 ; +use IO::Compress::Zlib::Extra 2.024 ; require Exporter ; @@ -28,7 +28,7 @@ Exporter::export_ok_tags('all'); $GunzipError = ''; -$VERSION = '2.022'; +$VERSION = '2.024'; sub new { @@ -47,7 +47,7 @@ sub gunzip sub getExtraParams { - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 qw(:Parse); return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ; } @@ -477,7 +477,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C<Append> is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C<Append> is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C<Append> is enabled, the filehandle will be positioned to the end of +the file via a call to C<seek> before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C<Append> is specified, and set to true, it will I<append> all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C<Append> is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -1032,7 +1073,7 @@ See L<IO::Uncompress::Gunzip::FAQ|IO::Uncompress::Gunzip::FAQ/"Compressed files =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -1063,7 +1104,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/Uncompress/Inflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm index 1a22263626..956f62e083 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.021 qw(:Status createSelfTiedObject); -use IO::Compress::Zlib::Constants 2.021 ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); +use IO::Compress::Zlib::Constants 2.024 ; -use IO::Uncompress::RawInflate 2.021 ; +use IO::Uncompress::RawInflate 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError); -$VERSION = '2.022'; +$VERSION = '2.024'; $InflateError = ''; @ISA = qw( Exporter IO::Uncompress::RawInflate ); @@ -398,7 +398,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C<Append> is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C<Append> is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C<Append> is enabled, the filehandle will be positioned to the end of +the file via a call to C<seek> before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C<Append> is specified, and set to true, it will I<append> all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C<Append> is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -903,7 +944,7 @@ See L<IO::Uncompress::Inflate::FAQ|IO::Uncompress::Inflate::FAQ/"Compressed file =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -934,7 +975,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/Uncompress/RawInflate.pm b/cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm index 3a45fcdde8..f017fa0f59 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.021 ; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); +use Compress::Raw::Zlib 2.024 ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); -use IO::Uncompress::Base 2.021 ; -use IO::Uncompress::Adapter::Inflate 2.021 ; +use IO::Uncompress::Base 2.024 ; +use IO::Uncompress::Adapter::Inflate 2.024 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError); -$VERSION = '2.022'; +$VERSION = '2.024'; $RawInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -546,7 +546,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C<Append> is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C<Append> is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C<Append> is enabled, the filehandle will be positioned to the end of +the file via a call to C<seek> before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C<Append> is specified, and set to true, it will I<append> all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C<Append> is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -1031,7 +1072,7 @@ See L<IO::Uncompress::RawInflate::FAQ|IO::Uncompress::RawInflate::FAQ/"Compresse =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -1062,7 +1103,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/Uncompress/Unzip.pm b/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm index c9f638ad2e..e7d6849f66 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm @@ -8,21 +8,21 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.021 ; -use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.021 ; -use IO::Uncompress::Adapter::Identity 2.021 ; -use IO::Compress::Zlib::Extra 2.021 ; -use IO::Compress::Zip::Constants 2.021 ; +use IO::Uncompress::RawInflate 2.024 ; +use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject); +use IO::Uncompress::Adapter::Inflate 2.024 ; +use IO::Uncompress::Adapter::Identity 2.024 ; +use IO::Compress::Zlib::Extra 2.024 ; +use IO::Compress::Zip::Constants 2.024 ; -use Compress::Raw::Zlib 2.021 qw(crc32) ; +use Compress::Raw::Zlib 2.024 qw(crc32) ; BEGIN { eval { require IO::Uncompress::Adapter::Bunzip2 ; import IO::Uncompress::Adapter::Bunzip2 } ; - eval { require IO::Uncompress::Adapter::UnLzma ; - import IO::Uncompress::Adapter::UnLzma } ; +# eval { require IO::Uncompress::Adapter::UnLzma ; +# import IO::Uncompress::Adapter::UnLzma } ; } @@ -30,7 +30,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup); -$VERSION = '2.022'; +$VERSION = '2.024'; $UnzipError = ''; @ISA = qw(Exporter IO::Uncompress::RawInflate); @@ -63,7 +63,7 @@ sub unzip sub getExtraParams { - use IO::Compress::Base::Common 2.021 qw(:Parse); + use IO::Compress::Base::Common 2.024 qw(:Parse); return ( @@ -650,34 +650,34 @@ sub _readZipHeader($) *$self->{Uncomp} = $obj; } - elsif ($compressedMethod == ZIP_CM_LZMA) - { - return $self->HeaderError("Unsupported Compression format $compressedMethod") - if ! defined $IO::Uncompress::Adapter::UnLzma::VERSION ; - - *$self->{Type} = 'zip-lzma'; - my $LzmaHeader; - $self->smartReadExact(\$LzmaHeader, 4) - or return $self->saveErrorString(undef, "Truncated file"); - my ($verHi, $verLo) = unpack ("CC", substr($LzmaHeader, 0, 2)); - my $LzmaPropertiesSize = unpack ("v", substr($LzmaHeader, 2, 2)); - - - my $LzmaPropertyData; - $self->smartReadExact(\$LzmaPropertyData, $LzmaPropertiesSize) - or return $self->saveErrorString(undef, "Truncated file"); - #my $LzmaInfo = unpack ("C", substr($LzmaPropertyData, 0, 1)); - #my $LzmaDictSize = unpack ("V", substr($LzmaPropertyData, 1, 4)); - - # Create an LZMA_Alone header - $self->pushBack($LzmaPropertyData . - $uncompressedLength->getPacked_V64()); - - my $obj = - IO::Uncompress::Adapter::UnLzma::mkUncompObject(); - - *$self->{Uncomp} = $obj; - } +# elsif ($compressedMethod == ZIP_CM_LZMA) +# { +# return $self->HeaderError("Unsupported Compression format $compressedMethod") +# if ! defined $IO::Uncompress::Adapter::UnLzma::VERSION ; +# +# *$self->{Type} = 'zip-lzma'; +# my $LzmaHeader; +# $self->smartReadExact(\$LzmaHeader, 4) +# or return $self->saveErrorString(undef, "Truncated file"); +# my ($verHi, $verLo) = unpack ("CC", substr($LzmaHeader, 0, 2)); +# my $LzmaPropertiesSize = unpack ("v", substr($LzmaHeader, 2, 2)); +# +# +# my $LzmaPropertyData; +# $self->smartReadExact(\$LzmaPropertyData, $LzmaPropertiesSize) +# or return $self->saveErrorString(undef, "Truncated file"); +# #my $LzmaInfo = unpack ("C", substr($LzmaPropertyData, 0, 1)); +# #my $LzmaDictSize = unpack ("V", substr($LzmaPropertyData, 1, 4)); +# +# # Create an LZMA_Alone header +# $self->pushBack($LzmaPropertyData . +# $uncompressedLength->getPacked_V64()); +# +# my $obj = +# IO::Uncompress::Adapter::UnLzma::mkUncompObject(); +# +# *$self->{Uncomp} = $obj; +# } elsif ($compressedMethod == ZIP_CM_STORE) { # TODO -- add support for reading uncompressed @@ -979,7 +979,48 @@ Defaults to 0. =item C<< Append => 0|1 >> -TODO +The behaviour of this option is dependent on the type of output data +stream. + +=over 5 + +=item * A Buffer + +If C<Append> is enabled, all uncompressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +uncompressed data is written to it. + +=item * A Filename + +If C<Append> is enabled, the file will be opened in append mode. Otherwise +the contents of the file, if any, will be truncated before any uncompressed +data is written to it. + +=item * A Filehandle + +If C<Append> is enabled, the filehandle will be positioned to the end of +the file via a call to C<seek> before any uncompressed data is +written to it. Otherwise the file pointer will not be moved. + +=back + +When C<Append> is specified, and set to true, it will I<append> all uncompressed +data to the output data stream. + +So when the output is a filehandle it will carry out a seek to the eof +before writing any uncompressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all uncompressed data will be appened to +the existing buffer. + +Conversely when C<Append> is not specified, or it is present and is set to +false, it will operate as follows. + +When the output is a filename, it will truncate the contents of the file +before writing any uncompressed data. If the output is a filehandle +its position will not be changed. If the output is a buffer, it will be +wiped before any uncompressed data is output. + +Defaults to 0. =item C<< MultiStream => 0|1 >> @@ -1470,7 +1511,7 @@ See L<IO::Uncompress::Unzip::FAQ|IO::Uncompress::Unzip::FAQ/"Compressed files an =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -1501,7 +1542,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/pod/FAQ.pod b/cpan/IO-Compress/pod/FAQ.pod index 0fee2a9f6d..b2df94fb78 100644 --- a/cpan/IO-Compress/pod/FAQ.pod +++ b/cpan/IO-Compress/pod/FAQ.pod @@ -487,7 +487,7 @@ file. =head1 SEE ALSO -L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<Compress::Zlib::FAQ|Compress::Zlib::FAQ> @@ -505,7 +505,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2009 Paul Marquess. All rights reserved. +Copyright (c) 2005-2010 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/t/000prereq.t b/cpan/IO-Compress/t/000prereq.t index 11b84fd85e..5ee058dc97 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.021'; + my $VERSION = '2.024'; my @NAMES = qw( Compress::Raw::Bzip2 Compress::Raw::Zlib diff --git a/cpan/IO-Compress/t/compress/CompTestUtils.pm b/cpan/IO-Compress/t/compress/CompTestUtils.pm index c5452b6b13..f21045d259 100644 --- a/cpan/IO-Compress/t/compress/CompTestUtils.pm +++ b/cpan/IO-Compress/t/compress/CompTestUtils.pm @@ -476,7 +476,7 @@ sub anyUncompress Append => 1, Transparent => 0, RawInflate => 1, - #UnLzma => 1, + UnLzma => 1, @opts or croak "Cannot open buffer/file: $AnyUncompressError" ; @@ -538,7 +538,7 @@ sub getHeaders Append => 1, Transparent => 0, RawInflate => 1, - #UnLzma => 1, + UnLzma => 1, @opts or croak "Cannot open buffer/file: $AnyUncompressError" ; diff --git a/cpan/IO-Compress/t/compress/any.pl b/cpan/IO-Compress/t/compress/any.pl index 23a23295aa..c0da133ebe 100644 --- a/cpan/IO-Compress/t/compress/any.pl +++ b/cpan/IO-Compress/t/compress/any.pl @@ -26,6 +26,9 @@ sub run my $Error = getErrorRef($CompressClass); my $UnError = getErrorRef($UncompressClass); + my @anyUnLz = (); + @anyUnLz = (UnLzma => 1 ) if $CompressClass =~ /lzma/i ; + my $AnyConstruct = "IO::Uncompress::${AnyClass}" ; no strict 'refs'; my $AnyError = \${ "IO::Uncompress::${AnyClass}::${AnyClass}Error" }; @@ -57,7 +60,7 @@ sub run { my $unc = new $AnyConstruct $input, Transparent => $trans, RawInflate => 1, - #UnLzma => 1, + @anyUnLz, Append => 1 ; ok $unc, " Created $AnyClass object" @@ -77,7 +80,7 @@ sub run { my $unc = new $AnyConstruct $input, Transparent => $trans, RawInflate => 1, - #UnLzma => 1, + @anyUnLz, Append => 1 ; ok $unc, " Created $AnyClass object" diff --git a/cpan/IO-Compress/t/cz-03zlib-v1.t b/cpan/IO-Compress/t/cz-03zlib-v1.t index 7358f4a5f0..acb69a0d15 100644 --- a/cpan/IO-Compress/t/cz-03zlib-v1.t +++ b/cpan/IO-Compress/t/cz-03zlib-v1.t @@ -23,16 +23,16 @@ BEGIN my $count = 0 ; if ($] < 5.005) { - $count = 390 ; + $count = 445 ; } else { - $count = 401 ; + $count = 456 ; } plan tests => $count + $extra ; - use_ok('Compress::Zlib', 2) ; + use_ok('Compress::Zlib', qw(:ALL memGunzip memGzip zlib_version)); use_ok('IO::Compress::Gzip::Constants') ; use_ok('IO::Compress::Gzip', qw($GzipError)) ; @@ -47,8 +47,8 @@ EOM my $len = length $hello ; # Check zlib_version and ZLIB_VERSION are the same. -is Compress::Zlib::zlib_version, ZLIB_VERSION, - "ZLIB_VERSION matches Compress::Zlib::zlib_version" ; +is zlib_version, ZLIB_VERSION, + "ZLIB_VERSION matches zlib_version" ; # generate a long random string my $contents = '' ; @@ -344,8 +344,9 @@ EOM # create an in-memory gzip file - my $dest = Compress::Zlib::memGzip($buffer) ; + my $dest = memGzip($buffer) ; ok length $dest ; + is $gzerrno, 0; # write it to disk ok open(FH, ">$name") ; @@ -366,14 +367,16 @@ EOM 1 while unlink $name ; # now check that memGunzip can deal with it. - my $ungzip = Compress::Zlib::memGunzip($dest) ; + my $ungzip = memGunzip($dest) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; # now do the same but use a reference - $dest = Compress::Zlib::memGzip(\$buffer) ; + $dest = memGzip(\$buffer) ; ok length $dest ; + is $gzerrno, 0; # write it to disk ok open(FH, ">$name") ; @@ -392,103 +395,121 @@ EOM # now check that memGunzip can deal with it. my $keep = $dest; - $ungzip = Compress::Zlib::memGunzip(\$dest) ; + $ungzip = memGunzip(\$dest) ; + is $gzerrno, 0; ok defined $ungzip ; ok $buffer eq $ungzip ; # check memGunzip can cope with missing gzip trailer my $minimal = substr($keep, 0, -1) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -2) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -3) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -4) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -5) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -6) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -7) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -8) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok defined $ungzip ; ok $buffer eq $ungzip ; + is $gzerrno, 0; $minimal = substr($keep, 0, -9) ; - $ungzip = Compress::Zlib::memGunzip(\$minimal) ; + $ungzip = memGunzip(\$minimal) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; 1 while unlink $name ; # check corrupt header -- too short $dest = "x" ; - my $result = Compress::Zlib::memGunzip($dest) ; + my $result = memGunzip($dest) ; ok !defined $result ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # check corrupt header -- full of junk $dest = "x" x 200 ; - $result = Compress::Zlib::memGunzip($dest) ; + $result = memGunzip($dest) ; ok !defined $result ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt header - 1st byte wrong my $bad = $keep ; substr($bad, 0, 1) = "\xFF" ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt header - 2st byte wrong $bad = $keep ; substr($bad, 1, 1) = "\xFF" ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt header - method not deflated $bad = $keep ; substr($bad, 2, 1) = "\xFF" ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt header - reserverd bits used $bad = $keep ; substr($bad, 3, 1) = "\xFF" ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt trailer - length wrong $bad = $keep ; substr($bad, -8, 4) = "\xFF" x 4 ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; # corrupt trailer - CRC wrong $bad = $keep ; substr($bad, -4, 4) = "\xFF" x 4 ; - $ungzip = Compress::Zlib::memGunzip(\$bad) ; + $ungzip = memGunzip(\$bad) ; ok ! defined $ungzip ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -535,7 +556,8 @@ EOM my $compr = readFile($name); ok length $compr ; - my $unc = Compress::Zlib::memGunzip($compr) ; + my $unc = memGunzip($compr) ; + is $gzerrno, 0; ok defined $unc ; ok $buffer eq $unc ; 1 while unlink $name ; @@ -897,10 +919,12 @@ if ($] >= 5.005) foreach (1 .. 20000) { $contents .= chr int rand 256 } - ok my $compressed = Compress::Zlib::memGzip(\$contents) ; + ok my $compressed = memGzip(\$contents) ; + is $gzerrno, 0; ok length $compressed > 4096 ; - ok my $out = Compress::Zlib::memGunzip(\$compressed) ; + ok my $out = memGunzip(\$compressed) ; + is $gzerrno, 0; ok $contents eq $out ; is length $out, length $contents ; @@ -926,7 +950,8 @@ EOM my $buffer = $good ; substr($buffer, 0, 1) = 'x' ; - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -934,7 +959,8 @@ EOM my $buffer = $good ; substr($buffer, 1, 1) = "\xFF" ; - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -942,7 +968,8 @@ EOM my $buffer = $good ; substr($buffer, 2, 1) = 'x' ; - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -950,7 +977,8 @@ EOM my $buffer = $good ; substr($buffer, 3, 1) = "\xff"; - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } } @@ -970,7 +998,8 @@ EOM substr($truncated, $index) = '' ; - ok ! Compress::Zlib::memGunzip(\$truncated) ; + ok ! memGunzip(\$truncated) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } @@ -990,7 +1019,8 @@ EOM substr($truncated, $index) = '' ; - ok ! Compress::Zlib::memGunzip(\$truncated) ; + ok ! memGunzip(\$truncated) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } my $Comment = "comment" ; @@ -1007,7 +1037,8 @@ EOM ok $x->close ; substr($truncated, $index) = '' ; - ok ! Compress::Zlib::memGunzip(\$truncated) ; + ok ! memGunzip(\$truncated) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } for my $index ( GZIP_MIN_HEADER_SIZE .. GZIP_MIN_HEADER_SIZE + GZIP_FHCRC_SIZE -1) @@ -1024,7 +1055,8 @@ EOM substr($truncated, $index) = '' ; - ok ! Compress::Zlib::memGunzip(\$truncated) ; + ok ! memGunzip(\$truncated) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -1046,9 +1078,10 @@ EOM ok defined $buffer ; - ok my $got = Compress::Zlib::memGunzip($buffer) + ok my $got = memGunzip($buffer) or diag "gzerrno is $gzerrno" ; is $got, $string ; + is $gzerrno, 0; } @@ -1072,7 +1105,8 @@ EOM substr($buffer, $trim) = ''; - ok my $u = Compress::Zlib::memGunzip(\$buffer) ; + ok my $u = memGunzip(\$buffer) ; + is $gzerrno, 0; ok $u eq $string; } @@ -1082,7 +1116,8 @@ EOM my $buffer = $good ; substr($buffer, -4, 4) = pack('V', 1234); - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } { @@ -1091,7 +1126,8 @@ EOM substr($buffer, -4, 4) = pack('V', 1234); substr($buffer, -8, 4) = pack('V', 1234); - ok ! Compress::Zlib::memGunzip(\$buffer) ; + ok ! memGunzip(\$buffer) ; + cmp_ok $gzerrno, "==", Z_DATA_ERROR ; } } diff --git a/cpan/IO-Compress/t/cz-08encoding.t b/cpan/IO-Compress/t/cz-08encoding.t index f377609e57..ba833a48af 100644 --- a/cpan/IO-Compress/t/cz-08encoding.t +++ b/cpan/IO-Compress/t/cz-08encoding.t @@ -30,15 +30,15 @@ BEGIN plan tests => 29 + $extra ; - use_ok('Compress::Zlib', 2); + use_ok('Compress::Zlib', qw(:ALL zlib_version memGunzip memGzip)); } # Check zlib_version and ZLIB_VERSION are the same. -is Compress::Zlib::zlib_version, ZLIB_VERSION, - "ZLIB_VERSION matches Compress::Zlib::zlib_version" ; +is zlib_version, ZLIB_VERSION, + "ZLIB_VERSION matches zlib_version" ; { @@ -46,7 +46,7 @@ is Compress::Zlib::zlib_version, ZLIB_VERSION, # length of this string is 2 characters my $s = "\x{df}\x{100}"; - my $cs = Compress::Zlib::memGzip(Encode::encode_utf8($s)); + my $cs = memGzip(Encode::encode_utf8($s)); # length stored at end of gzip file should be 4 my ($crc, $len) = unpack ("VV", substr($cs, -8, 8)); @@ -58,12 +58,12 @@ is Compress::Zlib::zlib_version, ZLIB_VERSION, title "memGunzip when compressed gzip has been encoded" ; my $s = "hello world" ; - my $co = Compress::Zlib::memGzip($s); - is Compress::Zlib::memGunzip(my $x = $co), $s, " match uncompressed"; + my $co = memGzip($s); + is memGunzip(my $x = $co), $s, " match uncompressed"; utf8::upgrade($co); - my $un = Compress::Zlib::memGunzip($co); + my $un = memGunzip($co); ok $un, " got uncompressed"; is $un, $s, " uncompressed matched original"; @@ -116,16 +116,16 @@ is Compress::Zlib::zlib_version, ZLIB_VERSION, title "Catch wide characters"; my $a = "a\xFF\x{100}"; - eval { Compress::Zlib::memGzip($a) }; + eval { memGzip($a) }; like($@, qr/Wide character in memGzip/, " wide characters in memGzip"); - eval { Compress::Zlib::memGunzip($a) }; + eval { memGunzip($a) }; like($@, qr/Wide character in memGunzip/, " wide characters in memGunzip"); - eval { Compress::Zlib::compress($a) }; + eval { compress($a) }; like($@, qr/Wide character in compress/, " wide characters in compress"); - eval { Compress::Zlib::uncompress($a) }; + eval { uncompress($a) }; like($@, qr/Wide character in uncompress/, " wide characters in uncompress"); my $lex = new LexFile my $name ; |