From d54256afc28ed33a89f23365fc63a119b103848d Mon Sep 17 00:00:00 2001 From: Paul Marquess Date: Sun, 20 Apr 2008 16:54:46 +0100 Subject: [PATCH] Update Compression modules to version 2.009 From: "Paul Marquess" Message-ID: <006601c8a2f6$7d18a200$6501a8c0@myopwv.com> p4raw-id: //depot/perl@33716 --- MANIFEST | 4 + ext/Compress/Raw/Zlib/Changes | 4 + ext/Compress/Raw/Zlib/README | 64 +-- ext/Compress/Raw/Zlib/Zlib.xs | 3 +- ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm | 27 +- ext/Compress/Raw/Zlib/pod/FAQ.pod | 142 ++++++ ext/Compress/Zlib/Changes | 5 + ext/Compress/Zlib/Makefile.PL | 2 +- ext/Compress/Zlib/README | 42 +- ext/Compress/Zlib/lib/Compress/Zlib.pm | 41 +- ext/Compress/Zlib/pod/FAQ.pod | 125 +++++ ext/IO_Compress_Base/Changes | 26 ++ ext/IO_Compress_Base/README | 42 +- ext/IO_Compress_Base/lib/File/GlobMapper.pm | 20 +- ext/IO_Compress_Base/lib/IO/Compress/Base.pm | 33 +- .../lib/IO/Compress/Base/Common.pm | 5 +- .../lib/IO/Uncompress/AnyUncompress.pm | 151 +----- ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm | 78 +++- ext/IO_Compress_Base/pod/FAQ.pod | 346 ++++++++++++++ ext/IO_Compress_Base/t/01misc.t | 7 +- ext/IO_Compress_Zlib/Changes | 9 + ext/IO_Compress_Zlib/Makefile.PL | 2 +- ext/IO_Compress_Zlib/README | 44 +- .../lib/IO/Compress/Adapter/Deflate.pm | 6 +- .../lib/IO/Compress/Adapter/Identity.pm | 4 +- ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm | 143 +----- ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm | 148 +----- .../lib/IO/Compress/Gzip/Constants.pm | 2 +- ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm | 145 +----- ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm | 225 ++++----- .../lib/IO/Compress/Zip/Constants.pm | 15 +- .../lib/IO/Compress/Zlib/Constants.pm | 2 +- ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm | 4 +- .../lib/IO/Uncompress/Adapter/Identity.pm | 6 +- .../lib/IO/Uncompress/Adapter/Inflate.pm | 6 +- .../lib/IO/Uncompress/AnyInflate.pm | 142 +----- ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm | 141 +----- ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm | 131 +----- .../lib/IO/Uncompress/RawInflate.pm | 125 +---- ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm | 171 ++----- ext/IO_Compress_Zlib/pod/FAQ.pod | 506 +++++++++++++++++++++ t/lib/compress/CompTestUtils.pm | 20 + t/lib/compress/generic.pl | 18 +- 43 files changed, 1587 insertions(+), 1595 deletions(-) create mode 100644 ext/Compress/Raw/Zlib/pod/FAQ.pod create mode 100644 ext/Compress/Zlib/pod/FAQ.pod create mode 100644 ext/IO_Compress_Base/pod/FAQ.pod create mode 100644 ext/IO_Compress_Zlib/pod/FAQ.pod diff --git a/MANIFEST b/MANIFEST index 302c771..da2b9ac 100644 --- a/MANIFEST +++ b/MANIFEST @@ -121,6 +121,7 @@ ext/Compress/Raw/Zlib/fallback/constants.h Compress::Raw::Zlib ext/Compress/Raw/Zlib/fallback/constants.xs Compress::Raw::Zlib ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm Compress::Raw::Zlib ext/Compress/Raw/Zlib/Makefile.PL Compress::Raw::Zlib +ext/Compress/Raw/Zlib/pod/FAQ.pod Compress::Raw::Zlib ext/Compress/Raw/Zlib/private/MakeUtil.pm Compress::Raw::Zlib ext/Compress/Raw/Zlib/README Compress::Raw::Zlib ext/Compress/Raw/Zlib/t/01version.t Compress::Raw::Zlib @@ -158,6 +159,7 @@ ext/Compress/Zlib/examples/gzgrep Compress::Zlib ext/Compress/Zlib/examples/gzstream Compress::Zlib ext/Compress/Zlib/lib/Compress/Zlib.pm Compress::Zlib ext/Compress/Zlib/Makefile.PL Compress::Zlib +ext/Compress/Zlib/pod/FAQ.pod Compress::Zlib ext/Compress/Zlib/private/MakeUtil.pm Compress::Zlib ext/Compress/Zlib/README Compress::Zlib ext/Compress/Zlib/t/01version.t Compress::Zlib @@ -705,6 +707,7 @@ ext/IO_Compress_Base/lib/IO/Compress/Base.pm IO::Compress::Base ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm IO::Compress::Base ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm IO::Compress::Base ext/IO_Compress_Base/Makefile.PL IO::Compress::Base +ext/IO_Compress_Base/pod/FAQ.pod IO::Compress::Base ext/IO_Compress_Base/private/MakeUtil.pm IO::Compress::Base ext/IO_Compress_Base/README IO::Compress::Base ext/IO_Compress_Base/t/01misc.t IO::Compress::Base @@ -733,6 +736,7 @@ ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm IO::Compress::Zlib ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm IO::Compress::Zlib ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm IO::Compress::Zlib ext/IO_Compress_Zlib/Makefile.PL IO::Compress::Zlib +ext/IO_Compress_Zlib/pod/FAQ.pod IO::Compress::Zlib ext/IO_Compress_Zlib/private/MakeUtil.pm IO::Compress::Zlib ext/IO_Compress_Zlib/README IO::Compress::Zlib ext/IO_Compress_Zlib/t/001zlib-generic-deflate.t IO::Compress::Zlib diff --git a/ext/Compress/Raw/Zlib/Changes b/ext/Compress/Raw/Zlib/Changes index 9cae2af..40c4ecb 100644 --- a/ext/Compress/Raw/Zlib/Changes +++ b/ext/Compress/Raw/Zlib/Changes @@ -1,6 +1,10 @@ CHANGES ------- + 2.009 20 April 2008 + + * No Changes + 2.008 2 November 2007 * Minor documentation changes in README diff --git a/ext/Compress/Raw/Zlib/README b/ext/Compress/Raw/Zlib/README index a296c4a..0a4216d 100644 --- a/ext/Compress/Raw/Zlib/README +++ b/ext/Compress/Raw/Zlib/README @@ -1,16 +1,14 @@ Compress-Raw-Zlib - Version 2.008 + Version 2.009 - 2nd November 2007 + 20th April 2008 - - Copyright (c) 2005-2007 Paul Marquess. All rights reserved. + Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - The directory zlib-src contains a subset of the source files copied directly from zlib version 1.2.3. These files are Copyright(C) 1995-2005 @@ -18,39 +16,27 @@ Full source for the zlib library is available at http://www.zlib.org - - DESCRIPTION ----------- - This module provides a Perl interface to the zlib compression library. - - - - PREREQUISITES ------------- Before you can build Compress-Raw-Zlib you need to have the following installed on your system: - * A C compiler * Perl 5.004 or better. - - By default, Compress-Raw-Zlib will build its own private copy of the zlib library. If you want to use a different version of zlib, follow the instructions in the section called "Controlling the version of zlib used by Compress-Raw-Zlib" later in this document. - - BUILDING THE MODULE ------------------- @@ -61,8 +47,6 @@ using this sequence of commands: make make test - - INSTALLATION ------------ @@ -70,9 +54,6 @@ To install Compress-Raw-Zlib, run the command below: make install - - - Controlling the version of zlib used by Compress-Raw-Zlib ---------------------------------------------------------- @@ -92,7 +73,6 @@ zlib library is used: Note that if you intend to use either Option 2 or 3, you need to have zlib version 1.0.5 or better. - The contents of the file config.in are used to control which of the three options is actually used. This file is read during the @@ -101,8 +81,6 @@ three options is actually used. This file is read during the step of the build, so remember to make any required changes to config.in before building this module. - - Option 1 -------- @@ -169,10 +147,9 @@ Setting the Gzip OS Code ------------------------ Every gzip stream stores a byte in its header to identify the Operating -System that was used to create the gzip stream. When you build -Compress-Raw-Zlib it will attempt to determine the value that is correct for -your Operating System. This will then be used by IO::Gzip as the default -value for the OS byte in all gzip headers it creates. +System that was used to create the gzip stream. When you build Compress-Raw-Zlib it will attempt to determine the value that is correct for +your Operating System. This will then be used by IO::Compress::Gzip as the +default value for the OS byte in all gzip headers it creates. The variable GZIP_OS_CODE in the config.in file controls the setting of this value when building Compress-Raw-Zlib. If GZIP_OS_CODE is set to @@ -197,17 +174,9 @@ If you find you have to change this value, because you think the value auto detected is incorrect, please take a few moments to contact the author of this module. - - TROUBLESHOOTING --------------- - - - - - - Solaris build fails with "language optional software package not installed" --------------------------------------------------------------------------- @@ -245,9 +214,6 @@ may vary. If that doesn't work for you, it's time to make changes to the Makefile by hand. Good luck! - - - Solaris build fails with "gcc: unrecognized option `-KPIC'" ----------------------------------------------------------- @@ -285,10 +251,6 @@ I've had a report that when building Compress-Raw-Zlib under HP-UX that it is necessary to have first built the zlib library with the -fpic option. - - - - Linux Notes ----------- @@ -307,9 +269,6 @@ This usually means that you have not installed the development RPM for zlib. Check for an RPM that start with "zlib-devel" in your Linux distribution. - - - Win32 Notes ----------- @@ -320,13 +279,9 @@ prompt C:\> ppm verify -upgrade Compress-Zlib - If you are not running Activestate Perl and you don't have access to a C compiler, you will not be able to build and install this module. - - - Win32 & Cygwin Notes -------------------- @@ -338,7 +293,6 @@ Windows. The workaround is to install Compress-Raw-Zlib manually using the instructions given at the start of this file. - FEEDBACK -------- @@ -372,8 +326,7 @@ To help me help you, I need all of the following information: If you haven't installed Compress-Raw-Zlib then search Compress::Raw::Zlib.pm for a line like this: - $VERSION = "2.008" ; - + $VERSION = "2.009" ; c. The version of zlib you have used. If you have successfully installed Compress-Raw-Zlib, this one-liner @@ -381,10 +334,8 @@ To help me help you, I need all of the following information: perl -MCompress::Raw::Zlib -e "print q[zlib ver ]. Compress::Raw::Zlib::ZLIB_VERSION.qq[\n]" - If not, look at the beginning of the file zlib.h. - 2. If you are having problems building Compress-Raw-Zlib, send me a complete log of what happened. Start by unpacking the Compress-Raw-Zlib module into a fresh directory and keep a log of all the steps @@ -394,5 +345,4 @@ To help me help you, I need all of the following information: make make test TEST_VERBOSE=1 - Paul Marquess diff --git a/ext/Compress/Raw/Zlib/Zlib.xs b/ext/Compress/Raw/Zlib/Zlib.xs index 2e27f8e..aee174e 100644 --- a/ext/Compress/Raw/Zlib/Zlib.xs +++ b/ext/Compress/Raw/Zlib/Zlib.xs @@ -228,7 +228,8 @@ typedef di_stream * Compress__Raw__Zlib__inflateScanStream ; #define adlerInitial adler32(0L, Z_NULL, 0) #define crcInitial crc32(0L, Z_NULL, 0) -static const char * const my_z_errmsg[] = { +//static const char * const my_z_errmsg[] = { +static const char my_z_errmsg[][32] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ diff --git a/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm b/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm index 9836740..7eb8915 100644 --- a/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm +++ b/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm @@ -13,7 +13,7 @@ use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); -$VERSION = '2.008'; +$VERSION = '2.009'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -568,8 +568,6 @@ The I module provides a Perl interface to the I compression library (see L for details about where to get I). - - =head1 Compress::Raw::Zlib::Deflate This section defines an interface that allows in-memory compression using @@ -577,7 +575,6 @@ the I interface provided by zlib. Here is a definition of the interface available: - =head2 B<($d, $status) = new Compress::Raw::Zlib::Deflate( [OPT] ) > Initialises a deflation object. @@ -678,7 +675,6 @@ calculated. Use the C<$d-Ecrc32> method to retrieve this value. This option defaults to false. - =item B<-ADLER32> If set to true, an adler32 checksum of the uncompressed data will be @@ -686,7 +682,6 @@ calculated. Use the C<$d-Eadler32> method to retrieve this value. This option defaults to false. - =back Here is an example of using the C optional @@ -696,7 +691,6 @@ level. All other options will take their default values. my $d = new Compress::Raw::Zlib::Deflate ( -Bufsize => 300, -Level => Z_BEST_SPEED ) ; - =head2 B<$status = $d-Edeflate($input, $output)> Deflates the contents of C<$input> and writes the compressed data to @@ -751,7 +745,6 @@ Change settings for the deflate object C<$d>. The list of the valid options is shown below. Options not specified will remain unchanged. - =over 5 =item B<-Level> @@ -772,7 +765,6 @@ and C<$d-Eflush> methods. If the buffer has to be reallocated to increase the size, it will grow in increments of C. - =back =head2 B<$status = $d-EdeflateTune($good_length, $max_lazy, $nice_length, $max_chain)> @@ -815,7 +807,6 @@ Returns the total number of compressed bytes output from deflate. Returns the deflation strategy currently used. Valid values are C, C and C. - =head2 B<$d-Eget_Level()> Returns the compression level being used. @@ -826,7 +817,6 @@ Returns the buffer size used to carry out the compression. =head2 Example - Here is a trivial example of using C. It simply reads standard input, deflates it and writes it to standard output. @@ -865,7 +855,6 @@ the I interface provided by zlib. Here is a definition of the interface: - =head2 B< ($i, $status) = new Compress::Raw::Zlib::Inflate( [OPT] ) > Initialises an inflation object. @@ -928,7 +917,6 @@ output buffer by the C<$i-Einflate> method. This option defaults to false. - =item B<-CRC32> If set to true, a crc32 checksum of the uncompressed data will be @@ -1048,7 +1036,6 @@ Note I are not present by default in compressed data streams. They must have been added explicitly when the data stream was created by calling C with C. - =head2 B<$i-Edict_adler()> Returns the adler32 value for the dictionary. @@ -1143,13 +1130,11 @@ the hard work for you. Check out the C module on CPAN at http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz - =head1 CONSTANTS All the I constants are automatically imported when you make use of I. - =head1 SEE ALSO L, L, L, L, L, L, L, L, L, L, L, L, L, L, L @@ -1160,7 +1145,6 @@ L, L, L, L - For RFC 1950, 1951 and 1952 see F, F and @@ -1174,25 +1158,18 @@ F. The primary site for gzip is F. - - - =head1 AUTHOR This module was written by Paul Marquess, F. - - =head1 MODIFICATION HISTORY See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2007 Paul Marquess. All rights reserved. +Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - - diff --git a/ext/Compress/Raw/Zlib/pod/FAQ.pod b/ext/Compress/Raw/Zlib/pod/FAQ.pod new file mode 100644 index 0000000..0a78bbb --- /dev/null +++ b/ext/Compress/Raw/Zlib/pod/FAQ.pod @@ -0,0 +1,142 @@ + +=head1 NAME + +Compress::Raw::Zlib::FAQ -- Frequently Asked Questions about Compress::Raw::Zlib + +=head1 DESCRIPTION + +Common questions answered. + +=head2 Compatibility with Unix compress/uncompress. + +This module is not compatible with Unix C. + +If you have the C program available, you can use this to read +compressed files + + open F, "uncompress -c $filename |"; + while () + { + ... + +Alternatively, if you have the C program available, you can use +this to read compressed files + + open F, "gunzip -c $filename |"; + while () + { + ... + +and this to write compress files, if you have the C program +available + + open F, "| compress -c $filename "; + print F "data"; + ... + close F ; + +=head2 Accessing .tar.Z files + +See previous FAQ item. + +If the C module is installed and either the C or +C programs are available, you can use one of these workarounds to +read C<.tar.Z> files. + +Firstly with C + + use strict; + use warnings; + use Archive::Tar; + + open F, "uncompress -c $filename |"; + my $tar = Archive::Tar->new(*F); + ... + +and this with C + + use strict; + use warnings; + use Archive::Tar; + + open F, "gunzip -c $filename |"; + my $tar = Archive::Tar->new(*F); + ... + +Similarly, if the C program is available, you can use this to +write a C<.tar.Z> file + + use strict; + use warnings; + use Archive::Tar; + use IO::File; + + my $fh = new IO::File "| compress -c >$filename"; + my $tar = Archive::Tar->new(); + ... + $tar->write($fh); + $fh->close ; + +=head2 Accessing Zip Files + +This module does not support reading/writing zip files. + +Support for reading/writing zip files is included with the +C and C modules. + +The primary focus of the C and C +modules is to provide an C compatible streaming read/write +interface to zip files/buffers. They are not fully flegged archivers. If +you are looking for an archiver check out the C module. You +can find it on CPAN at + + http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz + +=head2 Zlib Library Version Support + +By default C will build with a private copy of version +1.2.3 of the zlib library. (See the F file for details of +how to override this behaviour) + +If you decide to use a different version of the zlib library, you need to be +aware of the following issues + +=over 5 + +=item * + +First off, you must have zlib 1.0.5 or better. + +=item * + +You need to have zlib 1.2.1 or better if you want to use the C<-Merge> +option with C, C and +C. + +=back + +=head1 SEE ALSO + +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L + +L + +L, L, +L, +L + +=head1 AUTHOR + +This module was written by Paul Marquess, F. + +=head1 MODIFICATION HISTORY + +See the Changes file. + +=head1 COPYRIGHT AND LICENSE + +Copyright (c) 2005-2008 Paul Marquess. All rights reserved. + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + diff --git a/ext/Compress/Zlib/Changes b/ext/Compress/Zlib/Changes index 835a47d..c62b1bc 100644 --- a/ext/Compress/Zlib/Changes +++ b/ext/Compress/Zlib/Changes @@ -1,6 +1,11 @@ CHANGES ------- + 2.009 20 April 2008 + + * Minor documentation issue with flush. + [rt.cpan.org #31446] + 2.008 2 November 2007 * Minor documentation changes in README diff --git a/ext/Compress/Zlib/Makefile.PL b/ext/Compress/Zlib/Makefile.PL index 5855218..d7d5bb1 100755 --- a/ext/Compress/Zlib/Makefile.PL +++ b/ext/Compress/Zlib/Makefile.PL @@ -3,7 +3,7 @@ use strict ; require 5.004 ; -$::VERSION = '2.008' ; +$::VERSION = '2.009' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; diff --git a/ext/Compress/Zlib/README b/ext/Compress/Zlib/README index 8fd701b..47b634e 100644 --- a/ext/Compress/Zlib/README +++ b/ext/Compress/Zlib/README @@ -1,43 +1,29 @@ Compress-Zlib - Version 2.008 + Version 2.009 - 2nd November 2007 + 20th April 2008 - - Copyright (c) 1995-2007 Paul Marquess. All rights reserved. + Copyright (c) 1995-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - - - DESCRIPTION ----------- - This module provides a Perl interface to the zlib compression library. - - - - PREREQUISITES ------------- Before you can build Compress-Zlib you need to have the following installed on your system: - * Perl 5.004 or better. * Compress::Raw::Zlib * IO::Compress::Gzip - - - - BUILDING THE MODULE ------------------- @@ -48,8 +34,6 @@ using this sequence of commands: make make test - - INSTALLATION ------------ @@ -57,14 +41,9 @@ To install Compress-Zlib, run the command below: make install - - - - TROUBLESHOOTING --------------- - Undefined Symbol gzsetparams ---------------------------- @@ -82,8 +61,6 @@ There are two ways to fix this problem: 2. Edit config.in and set the OLD_ZLIB variable to True. - - Test Harness 01version fails ---------------------------- If the 01version test harness fails, and the problem isn't covered by the @@ -96,14 +73,6 @@ Run the command below to see if this is indeed the case Try removing the one you don't want to use and rebuild. - - - - - - - - FEEDBACK -------- @@ -137,9 +106,7 @@ To help me help you, I need all of the following information: If you haven't installed Compress-Zlib then search Compress::Zlib.pm for a line like this: - $VERSION = "2.008" ; - - + $VERSION = "2.009" ; 2. If you are having problems building Compress-Zlib, send me a complete log of what happened. Start by unpacking the Compress-Zlib @@ -150,5 +117,4 @@ To help me help you, I need all of the following information: make make test TEST_VERBOSE=1 - Paul Marquess diff --git a/ext/Compress/Zlib/lib/Compress/Zlib.pm b/ext/Compress/Zlib/lib/Compress/Zlib.pm index 9e02746..eff5491 100644 --- a/ext/Compress/Zlib/lib/Compress/Zlib.pm +++ b/ext/Compress/Zlib/lib/Compress/Zlib.pm @@ -8,17 +8,17 @@ use Carp ; use IO::Handle ; use Scalar::Util qw(dualvar); -use IO::Compress::Base::Common 2.008 ; -use Compress::Raw::Zlib 2.008 ; -use IO::Compress::Gzip 2.008 ; -use IO::Uncompress::Gunzip 2.008 ; +use IO::Compress::Base::Common 2.009 ; +use Compress::Raw::Zlib 2.009 ; +use IO::Compress::Gzip 2.009 ; +use IO::Uncompress::Gunzip 2.009 ; use strict ; use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); -$VERSION = '2.008'; +$VERSION = '2.009'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -452,7 +452,7 @@ sub inflate package Compress::Zlib ; -use IO::Compress::Gzip::Constants 2.008 ; +use IO::Compress::Gzip::Constants 2.009 ; sub memGzip($) { @@ -583,7 +583,7 @@ Compress::Zlib - Interface to zlib compression library ($d, $status) = deflateInit( [OPT] ) ; $status = $d->deflate($input, $output) ; - $status = $d->flush($output [, $flush_type]) ; + $status = $d->flush([$flush_type]) ; $d->deflateParams(OPTS) ; $d->deflateTune(OPTS) ; $d->dict_adler() ; @@ -635,8 +635,6 @@ Compress::Zlib - Interface to zlib compression library ZLIB_VERSION ZLIB_VERNUM - - =head1 DESCRIPTION The I module provides a Perl interface to the I @@ -808,7 +806,6 @@ documentation for details. Returns 0 on success. - =item B<$offset = $gz-Egztell() ;> Returns the uncompressed file offset. @@ -893,7 +890,6 @@ be used safely. =back - =head2 Examples Here is an example script which uses the interface. It implements a @@ -1022,7 +1018,6 @@ The C<$level> parameter defines the compression level. Valid values are C, and C. If C<$level> is not specified C will be used. - =item B<$dest = uncompress($source) ;> Uncompresses C<$source>. If successful it returns the uncompressed @@ -1039,7 +1034,6 @@ See L and L included with this distribution for an alternative interface for reading/writing RFC 1950 files/buffers. - =head1 Deflate Interface This section defines an interface that allows in-memory compression using @@ -1047,7 +1041,6 @@ the I interface provided by zlib. Here is a definition of the interface available: - =head2 B<($d, $status) = deflateInit( [OPT] )> Initialises a deflation stream. @@ -1140,10 +1133,8 @@ options will take their default values. deflateInit( -Bufsize => 300, -Level => Z_BEST_SPEED ) ; - =head2 B<($out, $status) = $d-Edeflate($buffer)> - Deflates the contents of C<$buffer>. The buffer can either be a scalar or a scalar reference. When finished, C<$buffer> will be completely processed (assuming there were no errors). If the deflation @@ -1159,8 +1150,8 @@ As with the I function in I, it is not necessarily the case that any output will be produced by this method. So don't rely on the fact that C<$out> is empty for an error test. - -=head2 B<($out, $status) = $d-Eflush([flush_type])> +=head2 B<($out, $status) = $d-Eflush()> +=head2 B<($out, $status) = $d-Eflush($flush_type)> Typically used to finish the deflation. Any pending output will be returned via C<$out>. @@ -1218,7 +1209,6 @@ Returns the total number of compressed bytes output from deflate. =head2 Example - Here is a trivial example of using C. It simply reads standard input, deflates it and writes it to standard output. @@ -1257,7 +1247,6 @@ uncompression using the I interface provided by zlib. Here is a definition of the interface: - =head2 B<($i, $status) = inflateInit()> Initialises an inflation stream. @@ -1349,7 +1338,6 @@ Any other return code means that a flush point was not found. If more data is available, C can be called repeatedly with more compressed data until the flush point is found. - =head2 B<$i-Edict_adler()> Returns the adler32 value for the dictionary. @@ -1423,7 +1411,6 @@ These functions allow checksums to be merged. All the I constants are automatically imported when you make use of I. - =head1 SEE ALSO L, L, L, L, L, L, L, L, L, L, L, L, L, L @@ -1434,7 +1421,6 @@ L, L, L, L - For RFC 1950, 1951 and 1952 see F, F and @@ -1448,25 +1434,18 @@ F. The primary site for gzip is F. - - - =head1 AUTHOR This module was written by Paul Marquess, F. - - =head1 MODIFICATION HISTORY See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 1995-2007 Paul Marquess. All rights reserved. +Copyright (c) 1995-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - - diff --git a/ext/Compress/Zlib/pod/FAQ.pod b/ext/Compress/Zlib/pod/FAQ.pod new file mode 100644 index 0000000..d590412 --- /dev/null +++ b/ext/Compress/Zlib/pod/FAQ.pod @@ -0,0 +1,125 @@ + +=head1 NAME + +Compress::Zlib::FAQ -- Frequently Asked Questions about Compress::Zlib + +=head1 DESCRIPTION + +Common questions answered. + +=head2 Compatibility with Unix compress/uncompress. + +Although C has a pair of functions called C and +C, they are I related to the Unix programs of the same +name. The C module is not compatible with Unix +C. + +If you have the C program available, you can use this to read +compressed files + + open F, "uncompress -c $filename |"; + while () + { + ... + +Alternatively, if you have the C program available, you can use +this to read compressed files + + open F, "gunzip -c $filename |"; + while () + { + ... + +and this to write compress files, if you have the C program +available + + open F, "| compress -c $filename "; + print F "data"; + ... + close F ; + +=head2 Accessing .tar.Z files + +The C module can optionally use C (via the +C module) to access tar files that have been compressed with +C. Unfortunately tar files compressed with the Unix C +utility cannot be read by C and so cannot be directly +accessed by C. + +If the C or C programs are available, you can use one +of these workarounds to read C<.tar.Z> files from C + +Firstly with C + + use strict; + use warnings; + use Archive::Tar; + + open F, "uncompress -c $filename |"; + my $tar = Archive::Tar->new(*F); + ... + +and this with C + + use strict; + use warnings; + use Archive::Tar; + + open F, "gunzip -c $filename |"; + my $tar = Archive::Tar->new(*F); + ... + +Similarly, if the C program is available, you can use this to +write a C<.tar.Z> file + + use strict; + use warnings; + use Archive::Tar; + use IO::File; + + my $fh = new IO::File "| compress -c >$filename"; + my $tar = Archive::Tar->new(); + ... + $tar->write($fh); + $fh->close ; + +=head2 Accessing Zip Files + +This module does not support reading/writing zip files. + +Support for reading/writing zip files is included with the +C and C modules. + +The primary focus of the C and C +modules is to provide an C compatible streaming read/write +interface to zip files/buffers. They are not fully flegged archivers. If +you are looking for an archiver check out the C module. You +can find it on CPAN at + + http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz + +=head1 SEE ALSO + +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L + +L + +L, L, +L, +L + +=head1 AUTHOR + +This module was written by Paul Marquess, F. + +=head1 MODIFICATION HISTORY + +See the Changes file. + +=head1 COPYRIGHT AND LICENSE + +Copyright (c) 2005-2008 Paul Marquess. All rights reserved. + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + diff --git a/ext/IO_Compress_Base/Changes b/ext/IO_Compress_Base/Changes index 13803d1..5a00b59 100644 --- a/ext/IO_Compress_Base/Changes +++ b/ext/IO_Compress_Base/Changes @@ -1,6 +1,32 @@ CHANGES ------- + 2.009 20 April 2008 + + * Removed the alpha status from File::GlobMapper + + * IO::Compress::Base + When writing output never output a zero length buffer. + Done to improve interoperability with other tied filenandle + modules. + + * Changed IO::Uncompress::Base to not use the offset parameter of + the read method when reading from a filehandle. + + The object returned from Net::FTP::retr implements a non-standard + read method. The third parameter is used for a timeout value + rather than an offset. + [rt.cpan#33231] + + * Changed IO::Uncompress::Base to not use the eof method when + reading from a filehandle. + + The object returned from Net::FTP::retr implements both the read + method and the eof method. Unfortunately the implementation of + the read method uses non-buffered IO (by using sysread) while + the eof method uses buffered IO. Mixing buffered and non-buffered + IO results in data corruption. + 2.008 2 November 2007 * Minor documentation changes in README diff --git a/ext/IO_Compress_Base/README b/ext/IO_Compress_Base/README index 2f71ec4..2ac1712 100644 --- a/ext/IO_Compress_Base/README +++ b/ext/IO_Compress_Base/README @@ -1,42 +1,28 @@ IO-Compress-Base - Version 2.008 + Version 2.009 - 2nd November 2007 + 20th April 2008 - - Copyright (c) 2005-2007 Paul Marquess. All rights reserved. + Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - - - DESCRIPTION ----------- - This module is the base class for all IO::Compress and IO::Uncompress modules. - - - - PREREQUISITES ------------- Before you can build IO-Compress-Base you need to have the following installed on your system: - * Perl 5.004 or better. - - - - BUILDING THE MODULE ------------------- @@ -47,8 +33,6 @@ using this sequence of commands: make make test - - INSTALLATION ------------ @@ -56,24 +40,9 @@ To install IO-Compress-Base, run the command below: make install - - - - TROUBLESHOOTING --------------- - - - - - - - - - - - FEEDBACK -------- @@ -107,9 +76,7 @@ To help me help you, I need all of the following information: If you haven't installed IO-Compress-Base then search IO::Compress::Base.pm for a line like this: - $VERSION = "2.008" ; - - + $VERSION = "2.009" ; 2. If you are having problems building IO-Compress-Base, send me a complete log of what happened. Start by unpacking the IO-Compress-Base @@ -120,5 +87,4 @@ To help me help you, I need all of the following information: make make test TEST_VERBOSE=1 - Paul Marquess diff --git a/ext/IO_Compress_Base/lib/File/GlobMapper.pm b/ext/IO_Compress_Base/lib/File/GlobMapper.pm index 9e7c217..40a6063 100644 --- a/ext/IO_Compress_Base/lib/File/GlobMapper.pm +++ b/ext/IO_Compress_Base/lib/File/GlobMapper.pm @@ -26,7 +26,7 @@ BEGIN our ($Error); our ($VERSION, @EXPORT_OK); -$VERSION = '0.000_02'; +$VERSION = '1.000'; @EXPORT_OK = qw( globmap ); @@ -389,24 +389,6 @@ File::GlobMapper - Extend File Glob to Allow Input and Output Files =head1 DESCRIPTION -B - -=over 5 - -=item * This code is a work in progress. - -=item * There are known bugs. - -=item * The interface defined here is tentative. - -=item * There are portability issues. - -=item * Do not use in production code. - -=item * Consider yourself warned! - -=back - This module needs Perl5.005 or better. This module takes the existing C module as a starting point and diff --git a/ext/IO_Compress_Base/lib/IO/Compress/Base.pm b/ext/IO_Compress_Base/lib/IO/Compress/Base.pm index c77be0d..cbd8d25 100644 --- a/ext/IO_Compress_Base/lib/IO/Compress/Base.pm +++ b/ext/IO_Compress_Base/lib/IO/Compress/Base.pm @@ -6,7 +6,7 @@ require 5.004 ; use strict ; use warnings; -use IO::Compress::Base::Common 2.008 ; +use IO::Compress::Base::Common 2.009 ; 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.008'; +$VERSION = '2.009'; #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. @@ -120,12 +120,14 @@ sub output &{ *$self->{FilterEnvelope} }(); } - if ( defined *$self->{FH} ) { - defined *$self->{FH}->write( $data, length $data ) - or return $self->saveErrorString(0, $!, $!); - } - else { - ${ *$self->{Buffer} } .= $data ; + if (length $data) { + if ( defined *$self->{FH} ) { + defined *$self->{FH}->write( $data, length $data ) + or return $self->saveErrorString(0, $!, $!); + } + else { + ${ *$self->{Buffer} } .= $data ; + } } return 1; @@ -939,23 +941,17 @@ __END__ =head1 NAME - IO::Compress::Base - Base Class for IO::Compress modules - =head1 SYNOPSIS use IO::Compress::Base ; =head1 DESCRIPTION - This module is not intended for direct use in application code. Its sole purpose if to to be sub-classed by IO::Compress modules. - - - =head1 SEE ALSO L, L, L, L, L, L, L, L, L, L, L, L, L, L, L @@ -966,25 +962,18 @@ L, L, L, L - - - - =head1 AUTHOR This module was written by Paul Marquess, F. - - =head1 MODIFICATION HISTORY See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2007 Paul Marquess. All rights reserved. +Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - diff --git a/ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm b/ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm index ddd2335..8f4a5d0 100644 --- a/ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm +++ b/ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm @@ -11,7 +11,7 @@ use File::GlobMapper; require Exporter; our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE); @ISA = qw(Exporter); -$VERSION = '2.008'; +$VERSION = '2.009'; @EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput isaFileGlobString cleanFileGlobString oneTarget @@ -545,6 +545,9 @@ sub IO::Compress::Base::Parameters::parse } elsif (@_ == 1) { my $href = $_[0] ; + return $_[0] + if UNIVERSAL::isa($_[0], "IO::Compress::Base::Parameters"); + return $self->setError("Expected even number of parameters, got 1") if ! defined $href or ! ref $href or ref $href ne "HASH" ; diff --git a/ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm b/ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm index 998de37..0553ab0 100644 --- a/ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm +++ b/ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm @@ -4,16 +4,16 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.008 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.009 qw(createSelfTiedObject); -use IO::Uncompress::Base 2.008 ; +use IO::Uncompress::Base 2.009 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError); -$VERSION = '2.008'; +$VERSION = '2.009'; $AnyUncompressError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -27,18 +27,18 @@ Exporter::export_ok_tags('all'); BEGIN { - eval ' use IO::Uncompress::Adapter::Inflate 2.008 ;'; - eval ' use IO::Uncompress::Adapter::Bunzip2 2.008 ;'; - eval ' use IO::Uncompress::Adapter::LZO 2.008 ;'; - eval ' use IO::Uncompress::Adapter::Lzf 2.008 ;'; - - eval ' use IO::Uncompress::Bunzip2 2.008 ;'; - eval ' use IO::Uncompress::UnLzop 2.008 ;'; - eval ' use IO::Uncompress::Gunzip 2.008 ;'; - eval ' use IO::Uncompress::Inflate 2.008 ;'; - eval ' use IO::Uncompress::RawInflate 2.008 ;'; - eval ' use IO::Uncompress::Unzip 2.008 ;'; - eval ' use IO::Uncompress::UnLzf 2.008 ;'; + eval ' use IO::Uncompress::Adapter::Inflate 2.009 ;'; + eval ' use IO::Uncompress::Adapter::Bunzip2 2.009 ;'; + eval ' use IO::Uncompress::Adapter::LZO 2.009 ;'; + eval ' use IO::Uncompress::Adapter::Lzf 2.009 ;'; + + eval ' use IO::Uncompress::Bunzip2 2.009 ;'; + eval ' use IO::Uncompress::UnLzop 2.009 ;'; + eval ' use IO::Uncompress::Gunzip 2.009 ;'; + eval ' use IO::Uncompress::Inflate 2.009 ;'; + eval ' use IO::Uncompress::RawInflate 2.009 ;'; + eval ' use IO::Uncompress::Unzip 2.009 ;'; + eval ' use IO::Uncompress::UnLzf 2.009 ;'; } sub new @@ -56,7 +56,7 @@ sub anyuncompress sub getExtraParams { - use IO::Compress::Base::Common 2.008 qw(:Parse); + use IO::Compress::Base::Common 2.009 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ; } @@ -188,10 +188,8 @@ __END__ =head1 NAME - IO::Uncompress::AnyUncompress - Uncompress gzip, zip, bzip2 or lzop file/buffer - =head1 SYNOPSIS use IO::Uncompress::AnyUncompress qw(anyuncompress $AnyUncompressError) ; @@ -235,10 +233,8 @@ IO::Uncompress::AnyUncompress - Uncompress gzip, zip, bzip2 or lzop file/buffer eof($z) close($z) - =head1 DESCRIPTION - This module provides a Perl interface that allows the reading of files/buffers that have been compressed with a variety of compression libraries. @@ -266,9 +262,6 @@ The formats supported are: The module will auto-detect which, if any, of the supported compression formats is being used. - - - =head1 Functional Interface A top-level function, C, is provided to carry out @@ -281,14 +274,10 @@ section. anyuncompress $input => $output [,OPTS] or die "anyuncompress failed: $AnyUncompressError\n"; - - The functional interface needs Perl5.005 or better. - =head2 anyuncompress $input => $output [, OPTS] - C expects at least two parameters, C<$input> and C<$output>. =head3 The C<$input> parameter @@ -327,8 +316,6 @@ The input data will be read from each file in turn. The complete array will be walked to ensure that it only contains valid filenames before any data is uncompressed. - - =item An Input FileGlob string If C<$input> is a string that is delimited by the characters "<" and ">" @@ -339,13 +326,10 @@ If the fileglob does not match any files ... See L for more details. - =back If the C<$input> parameter is any other type, C will be returned. - - =head3 The C<$output> parameter The parameter C<$output> is used to control the destination of the @@ -365,14 +349,11 @@ If the C<$output> parameter is a filehandle, the uncompressed data will be written to it. The string '-' can be used as an alias for standard output. - =item A scalar reference If C<$output> is a scalar reference, the uncompressed data will be stored in C<$$output>. - - =item An Array Reference If C<$output> is an array reference, the uncompressed data will be @@ -391,20 +372,13 @@ string. Anything else is an error. If the C<$output> parameter is any other type, C will be returned. - - =head2 Notes - When C<$input> maps to multiple compressed files/buffers and C<$output> is a single file/buffer, after uncompression C<$output> will contain a concatenation of all the uncompressed data from each of the input files/buffers. - - - - =head2 Optional Parameters Unless specified below, the optional parameters for C, @@ -424,7 +398,6 @@ completed. This parameter defaults to 0. - =item C<< BinModeOut => 0|1 >> When writing to a file or filehandle, set C before writing to the @@ -432,26 +405,17 @@ file. Defaults to 0. - - - - =item C<< Append => 0|1 >> TODO =item C<< MultiStream => 0|1 >> - If the input file/buffer contains multiple compressed data streams, this option will uncompress the whole lot as a single data stream. Defaults to 0. - - - - =item C<< TrailingData => $scalar >> Returns the data, if any, that is present immediately after the compressed @@ -471,19 +435,12 @@ of the input file. Don't bother using C if the input is a filename. - - If you know the length of the compressed data stream before you start uncompressing, you can avoid having to use C by setting the C option. - - =back - - - =head2 Examples To read the contents of the file C and write the @@ -498,7 +455,6 @@ compressed data to the file C. anyuncompress $input => $output or die "anyuncompress failed: $AnyUncompressError\n"; - To read from an existing Perl filehandle, C<$input>, and write the uncompressed data to a buffer, C<$buffer>. @@ -542,7 +498,6 @@ and if you want to compress each file one at a time, this will do the trick The format of the constructor for IO::Uncompress::AnyUncompress is shown below - my $z = new IO::Uncompress::AnyUncompress $input [OPTS] or die "IO::Uncompress::AnyUncompress failed: $AnyUncompressError\n"; @@ -574,7 +529,6 @@ If the C<$input> parameter is a filehandle, the compressed data will be read from it. The string '-' can be used as an alias for standard input. - =item A scalar reference If C<$input> is a scalar reference, the compressed data will be read from @@ -584,7 +538,6 @@ C<$$output>. =head2 Constructor Options - The option names defined below are case insensitive and can be optionally prefixed by a '-'. So all of the following are valid @@ -608,8 +561,6 @@ This parameter defaults to 0. =item C<< MultiStream => 0|1 >> - - Allows multiple concatenated compressed streams to be treated as a single compressed stream. Decompression will stop once either the end of the file/buffer is reached, an error is encountered (premature eof, corrupt @@ -618,7 +569,6 @@ start of another stream. This parameter defaults to 0. - =item C<< Prime => $string >> This option will uncompress the contents of C<$string> before processing the @@ -660,8 +610,6 @@ This option is mostly used when reading from a filehandle, in which case the file pointer will be left pointing to the first byte directly after the compressed data stream. - - This option defaults to off. =item C<< Append => 0|1 >> @@ -678,24 +626,12 @@ Defaults to 0. =item C<< Strict => 0|1 >> - - This option controls whether the extra checks defined below are used when carrying out the decompression. When Strict is on, the extra tests are carried out, when Strict is off they are not. The default for this option is off. - - - - - - - - - - =item C<< RawInflate => 0|1 >> When auto-detecting the compressed format, try to test for raw-deflate (RFC @@ -707,11 +643,6 @@ prone and can result is false positives. Defaults to 0. - - - - - =back =head2 Examples @@ -755,7 +686,6 @@ or an IO error is encountered. Returns the number of uncompressed bytes written to C<$buffer>, zero if eof or a negative number on error. - =head2 getline Usage is @@ -770,7 +700,6 @@ C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C is in use) to determine what constitutes an end of line. Paragraph mode, record mode and file slurp mode are all supported. - =head2 getc Usage is @@ -785,9 +714,6 @@ Usage is $char = $z->ungetc($string) - - - =head2 getHeaderInfo Usage is @@ -799,9 +725,6 @@ This method returns either a hash reference (in scalar context) or a list or hash references (in array context) that contains information about each of the header fields in the compressed data stream(s). - - - =head2 tell Usage is @@ -818,26 +741,17 @@ Usage is $z->eof(); eof($z); - - Returns true if the end of the compressed input stream has been reached. - - =head2 seek $z->seek($position, $whence); seek($z, $position, $whence); - - - Provides a sub-set of the C functionality, with the restriction that it is only legal to seek forward in the input file/buffer. It is a fatal error to attempt to seek backward. - - The C<$whence> parameter takes one the usual values, namely SEEK_SET, SEEK_CUR or SEEK_END. @@ -879,8 +793,6 @@ retrieve the autoflush setting. $z->input_line_number() $z->input_line_number(EXPR) - - Returns the current uncompressed line number. If C is present it has the effect of setting the line number. Note that setting the line number does not change the current position within the file/buffer being read. @@ -888,30 +800,25 @@ does not change the current position within the file/buffer being read. The contents of C<$/> are used to to determine what constitutes a line terminator. - - =head2 fileno $z->fileno() fileno($z) -If the C<$z> object is associated with a file or a filehandle, this method -will return the underlying file descriptor. +If the C<$z> object is associated with a file or a filehandle, C +will return the underlying file descriptor. Once the C method is +called C will return C. -If the C<$z> object is is associated with a buffer, this method will -return undef. +If the C<$z> object is is associated with a buffer, this method will return +C. =head2 close $z->close() ; close $z ; - - Closes the output file/buffer. - - For most versions of Perl this method will be automatically invoked if the IO::Uncompress::AnyUncompress object is destroyed (either explicitly or by the variable with the reference to the object going out of scope). The @@ -930,9 +837,6 @@ If the C option has been enabled when the IO::Uncompress::AnyUncompre object was created, and the object is associated with a file, the underlying file will also be closed. - - - =head2 nextStream Usage is @@ -971,8 +875,6 @@ of the input file. Don't bother using C if the input is a filename. - - If you know the length of the compressed data stream before you start uncompressing, you can avoid having to use C by setting the C option in the constructor. @@ -994,9 +896,6 @@ Same as doing this =head1 EXAMPLES - - - =head1 SEE ALSO L, L, L, L, L, L, L, L, L, L, L, L, L, L @@ -1007,23 +906,17 @@ L, L, L, L - - - - =head1 AUTHOR This module was written by Paul Marquess, F. - - =head1 MODIFICATION HISTORY See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2007 Paul Marquess. All rights reserved. +Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm b/ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm index f4ab1e4..110cde3 100644 --- a/ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm +++ b/ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm @@ -9,12 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter IO::File); -$VERSION = '2.008'; +$VERSION = '2.009'; use constant G_EOF => 0 ; use constant G_ERR => -1 ; -use IO::Compress::Base::Common 2.008 ; +use IO::Compress::Base::Common 2.009 ; #use Parse::Parameters ; use IO::File ; @@ -28,6 +28,7 @@ push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; #Exporter::export_ok_tags('all') ; + sub smartRead { my $self = $_[0]; @@ -59,12 +60,21 @@ sub smartRead my $get_size = $size - $offset ; - #if ( defined *$self->{InputLength} ) { - # $get_size = min($get_size, *$self->{InputLengthRemaining}); - #} - - if (defined *$self->{FH}) - { *$self->{FH}->read($$out, $get_size, $offset) } + if (defined *$self->{FH}) { + if ($offset) { + # Not using this + # + # *$self->{FH}->read($$out, $get_size, $offset); + # + # because the filehandle may not support the offset parameter + # An example is Net::FTP + my $tmp = ''; + *$self->{FH}->read($tmp, $get_size) > 0 && + (substr($$out, $offset) = $tmp); + } + else + { *$self->{FH}->read($$out, $get_size) } + } elsif (defined *$self->{InputEvent}) { my $got = 1 ; while (length $$out < $size) { @@ -174,7 +184,24 @@ sub smartEof return 0 if length *$self->{Prime} || *$self->{PushMode}; if (defined *$self->{FH}) - { *$self->{FH}->eof() } + { + # Could use + # + # *$self->{FH}->eof() + # + # here, but this can cause trouble if + # the filehandle is itself a tied handle, but it uses sysread. + # Then we get into mixing buffered & non-buffered IO, which will cause trouble + + my $info = $self->getErrInfo(); + + my $buffer = ''; + my $status = $self->smartRead(\$buffer, 1); + $self->pushBack($buffer) if length $buffer; + $self->setErrInfo($info); + + return $status == 0 ; + } elsif (defined *$self->{InputEvent}) { *$self->{EventEof} } else @@ -189,6 +216,22 @@ sub clearError ${ *$self->{Error} } = '' ; } +sub getErrInfo +{ + my $self = shift ; + + return [ *$self->{ErrorNo}, ${ *$self->{Error} } ] ; +} + +sub setErrInfo +{ + my $self = shift ; + my $ref = shift; + + *$self->{ErrorNo} = $ref->[0] ; + ${ *$self->{Error} } = $ref->[1] ; +} + sub saveStatus { my $self = shift ; @@ -929,7 +972,7 @@ sub gotoNextStream my $magic = $self->ckMagic(); #*$self->{EndStream} = 0 ; - if ( ! $magic) { + if ( ! defined $magic) { if (! *$self->{Transparent} ) { *$self->{EndStream} = 1 ; @@ -1372,23 +1415,17 @@ __END__ =head1 NAME - IO::Uncompress::Base - Base Class for IO::Uncompress modules - =head1 SYNOPSIS use IO::Uncompress::Base ; =head1 DESCRIPTION - This module is not intended for direct use in application code. Its sole purpose if to to be sub-classed by IO::Unompress modules. - - - =head1 SEE ALSO L, L, L, L, L, L, L, L, L, L, L, L, L, L, L @@ -1399,25 +1436,18 @@ L, L, L, L - - - - =head1 AUTHOR This module was written by Paul Marquess, F. - - =head1 MODIFICATION HISTORY See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2007 Paul Marquess. All rights reserved. +Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - diff --git a/ext/IO_Compress_Base/pod/FAQ.pod b/ext/IO_Compress_Base/pod/FAQ.pod new file mode 100644 index 0000000..16930fa --- /dev/null +++ b/ext/IO_Compress_Base/pod/FAQ.pod @@ -0,0 +1,346 @@ + +=head1 NAME + +IO::Compress::Base::FAQ -- Frequently Asked Questions about IO::Compress::Base + +=head1 DESCRIPTION + +Common questions answered. + +=head2 Compatibility with Unix compress/uncompress. + +This module is not compatible with Unix C. + +If you have the C program available, you can use this to read +compressed files + + open F, "uncompress -c $filename |"; + while () + { + ... + +Alternatively, if you have the C program available, you can use +this to read compressed files + + open F, "gunzip -c $filename |"; + while () + { + ... + +and this to write compress files, if you have the C program +available + + open F, "| compress -c $filename "; + print F "data"; + ... + close F ; + +=head2 Accessing .tar.Z files + +See previous FAQ item. + +If the C module is installed and either the C or +C programs are available, you can use one of these workarounds to +read C<.tar.Z> files. + +Firstly with C + + use strict; + use warnings; + use Archive::Tar; + + open F, "uncompress -c $filename |"; + my $tar = Archive::Tar->new(*F); + ... + +and this with C + + use strict; + use warnings; + use Archive::Tar; + + open F, "gunzip -c $filename |"; + my $tar = Archive::Tar->new(*F); + ... + +Similarly, if the C program is available, you can use this to +write a C<.tar.Z> file + + use strict; + use warnings; + use Archive::Tar; + use IO::File; + + my $fh = new IO::File "| compress -c >$filename"; + my $tar = Archive::Tar->new(); + ... + $tar->write($fh); + $fh->close ; + +=head2 Accessing Zip Files + +This module does not support reading/writing zip files. + +Support for reading/writing zip files is included with the +C and C modules. + +The primary focus of the C and C +modules is to provide an C compatible streaming read/write +interface to zip files/buffers. They are not fully flegged archivers. If +you are looking for an archiver check out the C module. You +can find it on CPAN at + + http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz + +=head2 Compressed files and Net::FTP + +The C module provides two low-level methods called C and +C that both return filehandles. These filehandles can used with the +C modules to compress or uncompress files read +from or written to an FTP Server on the fly, without having to create a +temporary file. + +Firstly, here is code that uses C to uncompressed a file as it is +read from the FTP Server. + + use Net::FTP; + use IO::Uncompress::Bunzip2 qw(:all); + + my $ftp = new Net::FTP ... + + my $retr_fh = $ftp->retr($compressed_filename); + bunzip2 $retr_fh => $outFilename, AutoClose => 1 + or die "Cannot uncompress '$compressed_file': $Bunzip2Error\n"; + +and this to compress a file as it is written to the FTP Server + + use Net::FTP; + use IO::Compress::Bzip2 qw(:all); + + my $stor_fh = $ftp->stor($filename); + bzip2 "filename" => $stor_fh, AutoClose => 1 + or die "Cannot compress '$filename': $Bzip2Error\n"; + +=head2 How do I recompress using a different compression? + +This is easier that you might expect if you realise that all the +C objects are derived from C and that all the +C modules can read from an C filehandle. + +So, for example, say you have a file compressed with gzip that you want to +recompress with bzip2. Here is all that is needed to carry out the +recompression. + + use IO::Uncompress::Gunzip ':all'; + use IO::Compress::Bzip2 ':all'; + + my $gzipFile = "somefile.gz"; + my $bzipFile = "somefile.bz2"; + + my $gunzip = new IO::Uncompress::Gunzip $gzipFile + or die "Cannot gunzip $gzipFile: $GunzipError\n" ; + + bzip2 $gunzip => $bzipFile + or die "Cannot bzip2 to $bzipFile: $Bzip2Error\n" ; + +Note, there is a limitation of this technique. Some compression file +formats store extra information along with the compressed data payload. For +example, gzip can optionally store the original filename and Zip stores a +lot of information about the original file. If the original compressed file +contains any of this extra information, it will not be transferred to the +new compressed file usign the technique above. + +=head2 Using C to uncompress data embedded in a larger file/buffer. + +A fairly common use-case is where compressed data is embedded in a larger +file/buffer and you want to read both. + +As an example consider the structure of a zip file. This is a well-defined +file format that mixes both compressed and uncompressed sections of data in +a single file. + +For the purposes of this discussion you can think of a zip file as sequence +of compressed data streams, each of which is prefixed by an uncompressed +local header. The local header contains information about the compressed +data stream, including the name of the compressed file and, in particular, +the length of the compressed data stream. + +To illustrate how to use C here is a script that walks a zip +file and prints out how many lines are in each compressed file (if you +intend write code to walking through a zip file for real see +L ) + + use strict; + use warnings; + + use IO::File; + use IO::Uncompress::RawInflate qw(:all); + + use constant ZIP_LOCAL_HDR_SIG => 0x04034b50; + use constant ZIP_LOCAL_HDR_LENGTH => 30; + + my $file = $ARGV[0] ; + + my $fh = new IO::File "<$file" + or die "Cannot open '$file': $!\n"; + + while (1) + { + my $sig; + my $buffer; + + my $x ; + ($x = $fh->read($buffer, ZIP_LOCAL_HDR_LENGTH)) == ZIP_LOCAL_HDR_LENGTH + or die "Truncated file: $!\n"; + + my $signature = unpack ("V", substr($buffer, 0, 4)); + + last unless $signature == ZIP_LOCAL_HDR_SIG; + + # Read Local Header + my $gpFlag = unpack ("v", substr($buffer, 6, 2)); + my $compressedMethod = unpack ("v", substr($buffer, 8, 2)); + my $compressedLength = unpack ("V", substr($buffer, 18, 4)); + my $uncompressedLength = unpack ("V", substr($buffer, 22, 4)); + my $filename_length = unpack ("v", substr($buffer, 26, 2)); + my $extra_length = unpack ("v", substr($buffer, 28, 2)); + + my $filename ; + $fh->read($filename, $filename_length) == $filename_length + or die "Truncated file\n"; + + $fh->read($buffer, $extra_length) == $extra_length + or die "Truncated file\n"; + + if ($compressedMethod != 8 && $compressedMethod != 0) + { + warn "Skipping file '$filename' - not deflated $compressedMethod\n"; + $fh->read($buffer, $compressedLength) == $compressedLength + or die "Truncated file\n"; + next; + } + + if ($compressedMethod == 0 && $gpFlag & 8 == 8) + { + die "Streamed Stored not supported for '$filename'\n"; + } + + next if $compressedLength == 0; + + # Done reading the Local Header + + my $inf = new IO::Uncompress::RawInflate $fh, + Transparent => 1, + InputLength => $compressedLength + or die "Cannot uncompress $file [$filename]: $RawInflateError\n" ; + + my $line_count = 0; + + while (<$inf>) + { + ++ $line_count; + } + + print "$filename: $line_count\n"; + } + +The majority of the code above is concerned with reading the zip local +header data. The code that I want to focus on is at the bottom. + + while (1) { + + # read local zip header data + # get $filename + # get $compressedLength + + my $inf = new IO::Uncompress::RawInflate $fh, + Transparent => 1, + InputLength => $compressedLength + or die "Cannot uncompress $file [$filename]: $RawInflateError\n" ; + + my $line_count = 0; + + while (<$inf>) + { + ++ $line_count; + } + + print "$filename: $line_count\n"; + } + +The call to C creates a new filehandle C<$inf> +that can be used to read from the parent filehandle C<$fh>, uncompressing +it as it goes. The use of the C option will guarantee that +I C<$compressedLength> bytes of compressed data will be read from +the C<$fh> filehandle (The only exception is for an error case like a +truncated file or a corrupt data stream). + +This means that once RawInflate is finished C<$fh> will be left at the +byte directly after the compressed data stream. + +Now consider what the code looks like without C + + while (1) { + + # read local zip header data + # get $filename + # get $compressedLength + + # read all the compressed data into $data + read($fh, $data, $compressedLength); + + my $inf = new IO::Uncompress::RawInflate \$data, + Transparent => 1, + or die "Cannot uncompress $file [$filename]: $RawInflateError\n" ; + + my $line_count = 0; + + while (<$inf>) + { + ++ $line_count; + } + + print "$filename: $line_count\n"; + } + +The difference here is the addition of the temporary variable C<$data>. +This is used to store a copy of the compressed data while it is being +uncompressed. + +If you know that C<$compressedLength> isn't that big then using temporary +storage won't be a problem. But if C<$compressedLength> is very large or +you are writing an application that other people will use, and so have no +idea how big C<$compressedLength> will be, it could be an issue. + +Using C avoids the use of temporary storage and means the +application can cope with large compressed data streams. + +One final point -- obviously C can only be used whenever you +know the length of the compressed data beforehand, like here with a zip +file. + +=head1 SEE ALSO + +L, L, L, L, L, L, L, L, L, L, L, L, L, L, L + +L + +L, L, +L, +L + +=head1 AUTHOR + +This module was written by Paul Marquess, F. + +=head1 MODIFICATION HISTORY + +See the Changes file. + +=head1 COPYRIGHT AND LICENSE + +Copyright (c) 2005-2008 Paul Marquess. All rights reserved. + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + diff --git a/ext/IO_Compress_Base/t/01misc.t b/ext/IO_Compress_Base/t/01misc.t index 59088c3..5c104e7 100644 --- a/ext/IO_Compress_Base/t/01misc.t +++ b/ext/IO_Compress_Base/t/01misc.t @@ -19,7 +19,7 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 78 + $extra ; + plan tests => 80 + $extra ; use_ok('Scalar::Util'); use_ok('IO::Compress::Base::Common'); @@ -120,6 +120,11 @@ undef) ; $$xx_ref = 666 ; is $xx, 666; + my $got1 = ParseParameters(1, {'Fred' => [1, 1, Parse_writable_scalar, undef]}, $got) ; + ok $got->parsed('Fred'), "parsed" ; + $xx_ref = $got->value('Fred'); + $$xx_ref = 666 ; + is $xx, 666; } My::testParseParameters(); diff --git a/ext/IO_Compress_Zlib/Changes b/ext/IO_Compress_Zlib/Changes index 4c0773c..206feb5 100644 --- a/ext/IO_Compress_Zlib/Changes +++ b/ext/IO_Compress_Zlib/Changes @@ -1,6 +1,15 @@ CHANGES ------- + 2.009 20 April 2008 + + * IO::Compress::Zip + + - Added exUnix2 option to allow storing of UID & GID. + - When running on a Unix derivative the ExtAttr option now defaults + to the equivalent of 0666. For all other systems the default + remains 0. + 2.008 2 November 2007 * Minor documentation changes in README diff --git a/ext/IO_Compress_Zlib/Makefile.PL b/ext/IO_Compress_Zlib/Makefile.PL index af9e6dd..afd6f22 100644 --- a/ext/IO_Compress_Zlib/Makefile.PL +++ b/ext/IO_Compress_Zlib/Makefile.PL @@ -3,7 +3,7 @@ use strict ; require 5.004 ; -$::VERSION = '2.008' ; +$::VERSION = '2.009' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; diff --git a/ext/IO_Compress_Zlib/README b/ext/IO_Compress_Zlib/README index 4c616e7..e26c701 100644 --- a/ext/IO_Compress_Zlib/README +++ b/ext/IO_Compress_Zlib/README @@ -1,44 +1,30 @@ IO-Compress-Zlib - Version 2.008 + Version 2.009 - 2nd November 2007 + 20th April 2008 - - Copyright (c) 2005-2007 Paul Marquess. All rights reserved. + Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - - - DESCRIPTION ----------- - This module provides a Perl interface to allow reading and writing of RFC 1950, 1951, 1952 (i.e. gzip) and zip files/buffers. - - - - PREREQUISITES ------------- Before you can build IO-Compress-Zlib you need to have the following installed on your system: - * Perl 5.004 or better. * Compress::Raw::Zlib * IO::Compress::Base - - - - BUILDING THE MODULE ------------------- @@ -49,8 +35,6 @@ using this sequence of commands: make make test - - INSTALLATION ------------ @@ -58,28 +42,16 @@ To install IO-Compress-Zlib, run the command below: make install - - - - TROUBLESHOOTING --------------- - - - - - - - - The t/020isize Test Suite ------------------------ This test suite checks that IO-Compress-Zlib can cope with gzip files that are larger than 2^32 bytes. -By default these test are NOT run when you do a "make test". If you +By default these tests are NOT run when you do a "make test". If you really want to run them, you need to execute "make longtest". Be warned though -- this test suite can take hours to run on a slow box. @@ -88,9 +60,6 @@ Also, due to the way the tests are constructed, some architectures will run out of memory during this test. This should not be considered a bug in the IO-Compress-Zlib module. - - - FEEDBACK -------- @@ -124,9 +93,7 @@ To help me help you, I need all of the following information: If you haven't installed IO-Compress-Zlib then search IO::Compress::Gzip.pm for a line like this: - $VERSION = "2.008" ; - - + $VERSION = "2.009" ; 2. If you are having problems building IO-Compress-Zlib, send me a complete log of what happened. Start by unpacking the IO-Compress-Zlib @@ -137,5 +104,4 @@ To help me help you, I need all of the following information: make make test TEST_VERBOSE=1 - Paul Marquess diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm index a712127..2ba4b2b 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.008 qw(:Status); +use IO::Compress::Base::Common 2.009 qw(:Status); -use Compress::Raw::Zlib 2.008 qw(Z_OK Z_FINISH MAX_WBITS) ; +use Compress::Raw::Zlib 2.009 qw(Z_OK Z_FINISH MAX_WBITS) ; our ($VERSION); -$VERSION = '2.008'; +$VERSION = '2.009'; sub mkCompObject { diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm index 83ccfeb..998792e 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm @@ -4,10 +4,10 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.008 qw(:Status); +use IO::Compress::Base::Common 2.009 qw(:Status); our ($VERSION); -$VERSION = '2.008'; +$VERSION = '2.009'; sub mkCompObject { diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm index 7a8e172..17b89d6 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm @@ -6,16 +6,16 @@ use bytes; require Exporter ; -use IO::Compress::RawDeflate 2.008 ; +use IO::Compress::RawDeflate 2.009 ; -use Compress::Raw::Zlib 2.008 ; -use IO::Compress::Zlib::Constants 2.008 ; -use IO::Compress::Base::Common 2.008 qw(createSelfTiedObject); +use Compress::Raw::Zlib 2.009 ; +use IO::Compress::Zlib::Constants 2.009 ; +use IO::Compress::Base::Common 2.009 qw(createSelfTiedObject); our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError); -$VERSION = '2.008'; +$VERSION = '2.009'; $DeflateError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -166,8 +166,6 @@ __END__ =head1 NAME - - IO::Compress::Deflate - Write RFC 1950 files/buffers @@ -176,7 +174,6 @@ IO::Compress::Deflate - Write RFC 1950 files/buffers use IO::Compress::Deflate qw(deflate $DeflateError) ; - my $status = deflate $input => $output [,OPTS] or die "deflate failed: $DeflateError\n"; @@ -218,24 +215,12 @@ IO::Compress::Deflate - Write RFC 1950 files/buffers =head1 DESCRIPTION - This module provides a Perl interface that allows writing compressed data to files or buffer as defined in RFC 1950. - - - - - - - - - - For reading RFC 1950 files/buffers, see the companion module L. - =head1 Functional Interface A top-level function, C, is provided to carry out @@ -248,14 +233,10 @@ section. deflate $input => $output [,OPTS] or die "deflate failed: $DeflateError\n"; - - The functional interface needs Perl5.005 or better. - =head2 deflate $input => $output [, OPTS] - C expects at least two parameters, C<$input> and C<$output>. =head3 The C<$input> parameter @@ -294,8 +275,6 @@ The input data will be read from each file in turn. The complete array will be walked to ensure that it only contains valid filenames before any data is compressed. - - =item An Input FileGlob string If C<$input> is a string that is delimited by the characters "<" and ">" @@ -306,13 +285,10 @@ If the fileglob does not match any files ... See L for more details. - =back If the C<$input> parameter is any other type, C will be returned. - - =head3 The C<$output> parameter The parameter C<$output> is used to control the destination of the @@ -332,14 +308,11 @@ If the C<$output> parameter is a filehandle, the compressed data will be written to it. The string '-' can be used as an alias for standard output. - =item A scalar reference If C<$output> is a scalar reference, the compressed data will be stored in C<$$output>. - - =item An Array Reference If C<$output> is an array reference, the compressed data will be @@ -358,21 +331,12 @@ string. Anything else is an error. If the C<$output> parameter is any other type, C will be returned. - - =head2 Notes - - When C<$input> maps to multiple files/buffers and C<$output> is a single file/buffer the input files/buffers will be stored in C<$output> as a concatenated series of compressed data streams. - - - - - =head2 Optional Parameters Unless specified below, the optional parameters for C, @@ -392,27 +356,18 @@ completed. This parameter defaults to 0. - =item C<< BinModeIn => 0|1 >> When reading from a file or filehandle, set C before reading. Defaults to 0. - - - - =item C<< Append => 0|1 >> TODO - - =back - - =head2 Examples To read the contents of the file C and write the compressed @@ -426,7 +381,6 @@ data to the file C. deflate $input => "$input.1950" or die "deflate failed: $DeflateError\n"; - To read from an existing Perl filehandle, C<$input>, and write the compressed data to a buffer, C<$buffer>. @@ -464,7 +418,6 @@ and if you want to compress each file one at a time, this will do the trick or die "Error compressing '$input': $DeflateError\n"; } - =head1 OO Interface =head2 Constructor @@ -504,7 +457,6 @@ If the C<$output> parameter is a filehandle, the compressed data will be written to it. The string '-' can be used as an alias for standard output. - =item A scalar reference If C<$output> is a scalar reference, the compressed data will be stored @@ -560,23 +512,15 @@ to it. Otherwise the file pointer will not be moved. This parameter defaults to 0. - - - - =item C<< Merge => 0|1 >> This option is used to compress input data and append it to an existing compressed data stream in C<$output>. The end result is a single compressed data stream stored in C<$output>. - - It is a fatal error to attempt to use this option when C<$output> is not an RFC 1950 data stream. - - There are a number of other limitations with the C option: =over 5 @@ -593,11 +537,8 @@ If C<$output> is a file or a filehandle, it must be seekable. =back - This parameter defaults to 0. - - =item -Level Defines the compression level used by zlib. The value should either be @@ -630,19 +571,10 @@ constants defined below. The default is Z_DEFAULT_STRATEGY. - - - - - =item C<< Strict => 0|1 >> - - This is a placeholder option. - - =back =head2 Examples @@ -704,14 +636,11 @@ unsuccessful. Usage is - $z->flush; $z->flush($flush_type); - Flushes any pending compressed data to the output file/buffer. - This method takes an optional parameter, C<$flush_type>, that controls how the flushing will be carried out. By default the C<$flush_type> used is C. Other valid values for C<$flush_type> are @@ -721,10 +650,8 @@ you fully understand the implications of what it does - overuse of C can seriously degrade the level of compression achieved. See the C documentation for details. - Returns true on success. - =head2 tell Usage is @@ -741,28 +668,19 @@ Usage is $z->eof(); eof($z); - - Returns true if the C method has been called. - - =head2 seek $z->seek($position, $whence); seek($z, $position, $whence); - - - Provides a sub-set of the C functionality, with the restriction that it is only legal to seek forward in the output file/buffer. It is a fatal error to attempt to seek backward. Empty parts of the file/buffer will have NULL (0x00) bytes written to them. - - The C<$whence> parameter takes one the usual values, namely SEEK_SET, SEEK_CUR or SEEK_END. @@ -804,33 +722,27 @@ retrieve the autoflush setting. $z->input_line_number() $z->input_line_number(EXPR) - This method always returns C when compressing. - - =head2 fileno $z->fileno() fileno($z) -If the C<$z> object is associated with a file or a filehandle, this method -will return the underlying file descriptor. +If the C<$z> object is associated with a file or a filehandle, C +will return the underlying file descriptor. Once the C method is +called C will return C. -If the C<$z> object is is associated with a buffer, this method will -return undef. +If the C<$z> object is is associated with a buffer, this method will return +C. =head2 close $z->close() ; close $z ; - - Flushes any pending compressed data and then closes the output file/buffer. - - For most versions of Perl this method will be automatically invoked if the IO::Compress::Deflate object is destroyed (either explicitly or by the variable with the reference to the object going out of scope). The @@ -849,9 +761,6 @@ If the C option has been enabled when the IO::Compress::Deflate object was created, and the object is associated with a file, the underlying file will also be closed. - - - =head2 newStream([OPTS]) Usage is @@ -865,7 +774,6 @@ the C<$z> object. See the L section for more details. - =head2 deflateParams Usage is @@ -874,20 +782,15 @@ Usage is TODO - =head1 Importing - A number of symbolic constants are required by some methods in C. None are imported by default. - - =over 5 =item :all - Imports C, C<$DeflateError> and all symbolic constants that can be used by C. Same as doing this @@ -897,10 +800,8 @@ constants that can be used by C. Same as doing this Import all symbolic constants. Same as doing this - use IO::Compress::Deflate qw(:flush :level :strategy) ; - =item :flush These symbolic constants are used by the C method. @@ -921,7 +822,6 @@ These symbolic constants are used by the C option in the constructor. Z_BEST_COMPRESSION Z_DEFAULT_COMPRESSION - =item :strategy These symbolic constants are used by the C option in the constructor. @@ -937,21 +837,17 @@ These symbolic constants are used by the C option in the constructor. =back -For - =head1 EXAMPLES -TODO - - - - - - +=head2 Apache::GZip Revisited +See L + +=head2 Working with Net::FTP +See L =head1 SEE ALSO @@ -963,7 +859,6 @@ L, L, L, L - For RFC 1950, 1951 and 1952 see F, F and @@ -977,24 +872,18 @@ F. The primary site for gzip is F. - - - =head1 AUTHOR This module was written by Paul Marquess, F. - - =head1 MODIFICATION HISTORY See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2007 Paul Marquess. All rights reserved. +Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm index 8bf64fe..2733830 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm @@ -8,12 +8,12 @@ use warnings; use bytes; -use IO::Compress::RawDeflate 2.008 ; +use IO::Compress::RawDeflate 2.009 ; -use Compress::Raw::Zlib 2.008 ; -use IO::Compress::Base::Common 2.008 qw(:Status :Parse createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.008 ; -use IO::Compress::Zlib::Extra 2.008 ; +use Compress::Raw::Zlib 2.009 ; +use IO::Compress::Base::Common 2.009 qw(:Status :Parse createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.009 ; +use IO::Compress::Zlib::Extra 2.009 ; BEGIN { @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError); -$VERSION = '2.008'; +$VERSION = '2.009'; $GzipError = '' ; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -274,8 +274,6 @@ __END__ =head1 NAME - - IO::Compress::Gzip - Write RFC 1952 files/buffers @@ -284,7 +282,6 @@ IO::Compress::Gzip - Write RFC 1952 files/buffers use IO::Compress::Gzip qw(gzip $GzipError) ; - my $status = gzip $input => $output [,OPTS] or die "gzip failed: $GzipError\n"; @@ -326,27 +323,15 @@ IO::Compress::Gzip - Write RFC 1952 files/buffers =head1 DESCRIPTION - This module provides a Perl interface that allows writing compressed data to files or buffer as defined in RFC 1952. - - - - All the gzip headers defined in RFC 1952 can be created using this module. - - - - - - For reading RFC 1952 files/buffers, see the companion module L. - =head1 Functional Interface A top-level function, C, is provided to carry out @@ -359,14 +344,10 @@ section. gzip $input => $output [,OPTS] or die "gzip failed: $GzipError\n"; - - The functional interface needs Perl5.005 or better. - =head2 gzip $input => $output [, OPTS] - C expects at least two parameters, C<$input> and C<$output>. =head3 The C<$input> parameter @@ -405,8 +386,6 @@ The input data will be read from each file in turn. The complete array will be walked to ensure that it only contains valid filenames before any data is compressed. - - =item An Input FileGlob string If C<$input> is a string that is delimited by the characters "<" and ">" @@ -417,12 +396,10 @@ If the fileglob does not match any files ... See L for more details. - =back 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 and C