357706338a
- update Compress::Raw::Zlib to 2.023 - update IO::Compress::Base, and IO::Compress::Zlib to 2.015 (#542645)
5233 lines
116 KiB
Diff
5233 lines
116 KiB
Diff
IO-Compress-Zlib-2.015
|
|
(omitting changes to private/MakeUtil.pm)
|
|
(omitting changes to perl-5.10.0/t/lib/compress; these are in
|
|
IO-Compress-Base 2.015 update)
|
|
|
|
diff -urN perl-5.10.0.orig/MANIFEST perl-5.10.0/MANIFEST
|
|
--- perl-5.10.0.orig/MANIFEST 2009-12-01 11:02:59.000000000 +0100
|
|
+++ perl-5.10.0/MANIFEST 2009-12-01 12:10:21.000000000 +0100
|
|
@@ -736,6 +736,7 @@
|
|
ext/IO_Compress_Zlib/t/002any-zip.t IO::Compress::Zlib
|
|
ext/IO_Compress_Zlib/t/004gziphdr.t IO::Compress::Zlib
|
|
ext/IO_Compress_Zlib/t/005defhdr.t IO::Compress::Zlib
|
|
+ext/IO_Compress_Zlib/t/006zip.t IO::Compress::Zlib
|
|
ext/IO_Compress_Zlib/t/010examples.t IO::Compress::Zlib
|
|
ext/IO_Compress_Zlib/t/020isize.t IO::Compress::Zlib
|
|
ext/IO_Compress_Zlib/t/050interop-gzip.t IO::Compress::Zlib
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/Changes perl-5.10.0/ext/IO_Compress_Zlib/Changes
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/Changes 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/Changes 2009-12-01 12:05:25.000000000 +0100
|
|
@@ -1,6 +1,44 @@
|
|
CHANGES
|
|
-------
|
|
|
|
+ 2.015 3 September 2008
|
|
+
|
|
+ * Makefile.PL
|
|
+ Backout changes made in 2.014
|
|
+
|
|
+ 2.014 2 September 2008
|
|
+
|
|
+ * Makefile.PL
|
|
+ Updated to check for indirect dependencies.
|
|
+
|
|
+ 2.012 15 July 2008
|
|
+
|
|
+ * No Changes
|
|
+
|
|
+ 2.011 17 May 2008
|
|
+
|
|
+ * IO::Uncompress::Unzip
|
|
+ - Print an error message if the zip file contains a
|
|
+ member compressed with bzip2 and IO::Uncompress::Bunzip2 is
|
|
+ not available.
|
|
+ - Could not cope with mixed compression zip files. For example a
|
|
+ zip file that contains both STORED and DEFLATED content.
|
|
+ [RT #35573]
|
|
+
|
|
+ 2.010 5 May 2008
|
|
+
|
|
+ * Fixed problem that meant Perl 5.10 could not upgrade this module.
|
|
+ [RT #35343]
|
|
+
|
|
+ 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 -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/Makefile.PL perl-5.10.0/ext/IO_Compress_Zlib/Makefile.PL
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/Makefile.PL 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/Makefile.PL 2009-12-01 12:05:35.000000000 +0100
|
|
@@ -3,7 +3,7 @@
|
|
use strict ;
|
|
require 5.004 ;
|
|
|
|
-$::VERSION = '2.008' ;
|
|
+$::VERSION = '2.015' ;
|
|
|
|
use private::MakeUtil;
|
|
use ExtUtils::MakeMaker 5.16 ;
|
|
@@ -51,6 +51,13 @@
|
|
|
|
INSTALLDIRS => ($] >= 5.009 ? 'perl' : 'site'),
|
|
|
|
+ (
|
|
+ $] >= 5.009 && ! $ENV{PERL_CORE}
|
|
+ ? (INST_LIB => 'blib/arch')
|
|
+ : ()
|
|
+ ),
|
|
+
|
|
+
|
|
((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
|
|
('LICENSE' => 'perl') : ()),
|
|
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/README perl-5.10.0/ext/IO_Compress_Zlib/README
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/README 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/README 2009-12-01 12:05:41.000000000 +0100
|
|
@@ -1,44 +1,30 @@
|
|
|
|
IO-Compress-Zlib
|
|
|
|
- Version 2.008
|
|
+ Version 2.015
|
|
|
|
- 2nd November 2007
|
|
+ 2nd September 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 @@
|
|
make
|
|
make test
|
|
|
|
-
|
|
-
|
|
INSTALLATION
|
|
------------
|
|
|
|
@@ -58,28 +42,16 @@
|
|
|
|
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 @@
|
|
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 @@
|
|
If you haven't installed IO-Compress-Zlib then search IO::Compress::Gzip.pm
|
|
for a line like this:
|
|
|
|
- $VERSION = "2.008" ;
|
|
-
|
|
-
|
|
+ $VERSION = "2.015" ;
|
|
|
|
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 @@
|
|
make
|
|
make test TEST_VERBOSE=1
|
|
|
|
-
|
|
Paul Marquess <pmqs@cpan.org>
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -4,12 +4,12 @@
|
|
use warnings;
|
|
use bytes;
|
|
|
|
-use IO::Compress::Base::Common 2.008 qw(:Status);
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status);
|
|
|
|
-use Compress::Raw::Zlib 2.008 qw(Z_OK Z_FINISH MAX_WBITS) ;
|
|
+use Compress::Raw::Zlib 2.015 qw(Z_OK Z_FINISH MAX_WBITS) ;
|
|
our ($VERSION);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
|
|
sub mkCompObject
|
|
{
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -4,10 +4,10 @@
|
|
use warnings;
|
|
use bytes;
|
|
|
|
-use IO::Compress::Base::Common 2.008 qw(:Status);
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status);
|
|
our ($VERSION);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
|
|
sub mkCompObject
|
|
{
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -6,16 +6,16 @@
|
|
|
|
require Exporter ;
|
|
|
|
-use IO::Compress::RawDeflate 2.008 ;
|
|
+use IO::Compress::RawDeflate 2.015 ;
|
|
|
|
-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.015 ;
|
|
+use IO::Compress::Zlib::Constants 2.015 ;
|
|
+use IO::Compress::Base::Common 2.015 qw(createSelfTiedObject);
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
$DeflateError = '';
|
|
|
|
@ISA = qw(Exporter IO::Compress::RawDeflate);
|
|
@@ -166,8 +166,6 @@
|
|
|
|
=head1 NAME
|
|
|
|
-
|
|
-
|
|
IO::Compress::Deflate - Write RFC 1950 files/buffers
|
|
|
|
|
|
@@ -176,7 +174,6 @@
|
|
|
|
use IO::Compress::Deflate qw(deflate $DeflateError) ;
|
|
|
|
-
|
|
my $status = deflate $input => $output [,OPTS]
|
|
or die "deflate failed: $DeflateError\n";
|
|
|
|
@@ -218,24 +215,12 @@
|
|
|
|
=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<IO::Uncompress::Inflate|IO::Uncompress::Inflate>.
|
|
|
|
-
|
|
=head1 Functional Interface
|
|
|
|
A top-level function, C<deflate>, is provided to carry out
|
|
@@ -248,14 +233,10 @@
|
|
deflate $input => $output [,OPTS]
|
|
or die "deflate failed: $DeflateError\n";
|
|
|
|
-
|
|
-
|
|
The functional interface needs Perl5.005 or better.
|
|
|
|
-
|
|
=head2 deflate $input => $output [, OPTS]
|
|
|
|
-
|
|
C<deflate> expects at least two parameters, C<$input> and C<$output>.
|
|
|
|
=head3 The C<$input> parameter
|
|
@@ -294,8 +275,6 @@
|
|
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 @@
|
|
|
|
See L<File::GlobMapper|File::GlobMapper> for more details.
|
|
|
|
-
|
|
=back
|
|
|
|
If the C<$input> parameter is any other type, C<undef> will be returned.
|
|
|
|
-
|
|
-
|
|
=head3 The C<$output> parameter
|
|
|
|
The parameter C<$output> is used to control the destination of the
|
|
@@ -332,14 +308,11 @@
|
|
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 @@
|
|
|
|
If the C<$output> parameter is any other type, C<undef> 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<deflate>,
|
|
@@ -392,27 +356,18 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< BinModeIn => 0|1 >>
|
|
|
|
When reading from a file or filehandle, set C<binmode> before reading.
|
|
|
|
Defaults to 0.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< Append => 0|1 >>
|
|
|
|
TODO
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
-
|
|
-
|
|
=head2 Examples
|
|
|
|
To read the contents of the file C<file1.txt> and write the compressed
|
|
@@ -426,7 +381,6 @@
|
|
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 @@
|
|
or die "Error compressing '$input': $DeflateError\n";
|
|
}
|
|
|
|
-
|
|
=head1 OO Interface
|
|
|
|
=head2 Constructor
|
|
@@ -504,7 +457,6 @@
|
|
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 @@
|
|
|
|
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<Merge> option:
|
|
|
|
=over 5
|
|
@@ -593,11 +537,8 @@
|
|
|
|
=back
|
|
|
|
-
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
-
|
|
=item -Level
|
|
|
|
Defines the compression level used by zlib. The value should either be
|
|
@@ -630,19 +571,10 @@
|
|
|
|
The default is Z_DEFAULT_STRATEGY.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< Strict => 0|1 >>
|
|
|
|
-
|
|
-
|
|
This is a placeholder option.
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
=head2 Examples
|
|
@@ -704,14 +636,11 @@
|
|
|
|
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<Z_FINISH>. Other valid values for C<$flush_type> are
|
|
@@ -721,10 +650,8 @@
|
|
can seriously degrade the level of compression achieved. See the C<zlib>
|
|
documentation for details.
|
|
|
|
-
|
|
Returns true on success.
|
|
|
|
-
|
|
=head2 tell
|
|
|
|
Usage is
|
|
@@ -741,28 +668,19 @@
|
|
$z->eof();
|
|
eof($z);
|
|
|
|
-
|
|
-
|
|
Returns true if the C<close> method has been called.
|
|
|
|
-
|
|
-
|
|
=head2 seek
|
|
|
|
$z->seek($position, $whence);
|
|
seek($z, $position, $whence);
|
|
|
|
-
|
|
-
|
|
-
|
|
Provides a sub-set of the C<seek> 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 @@
|
|
$z->input_line_number()
|
|
$z->input_line_number(EXPR)
|
|
|
|
-
|
|
This method always returns C<undef> 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<fileno>
|
|
+will return the underlying file descriptor. Once the C<close> method is
|
|
+called C<fileno> will return C<undef>.
|
|
|
|
-If the C<$z> object is is associated with a buffer, this method will
|
|
-return undef.
|
|
+If the C<$z> object is is associated with a buffer, this method will return
|
|
+C<undef>.
|
|
|
|
=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 @@
|
|
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 @@
|
|
|
|
See the L</"Constructor Options"> section for more details.
|
|
|
|
-
|
|
=head2 deflateParams
|
|
|
|
Usage is
|
|
@@ -874,20 +782,15 @@
|
|
|
|
TODO
|
|
|
|
-
|
|
=head1 Importing
|
|
|
|
-
|
|
A number of symbolic constants are required by some methods in
|
|
C<IO::Compress::Deflate>. None are imported by default.
|
|
|
|
-
|
|
-
|
|
=over 5
|
|
|
|
=item :all
|
|
|
|
-
|
|
Imports C<deflate>, C<$DeflateError> and all symbolic
|
|
constants that can be used by C<IO::Compress::Deflate>. Same as doing this
|
|
|
|
@@ -897,10 +800,8 @@
|
|
|
|
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<flush> method.
|
|
@@ -921,7 +822,6 @@
|
|
Z_BEST_COMPRESSION
|
|
Z_DEFAULT_COMPRESSION
|
|
|
|
-
|
|
=item :strategy
|
|
|
|
These symbolic constants are used by the C<Strategy> option in the constructor.
|
|
@@ -937,21 +837,17 @@
|
|
|
|
=back
|
|
|
|
-For
|
|
-
|
|
=head1 EXAMPLES
|
|
|
|
-TODO
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
+=head2 Apache::GZip Revisited
|
|
|
|
+See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Apache::GZip Revisited">
|
|
|
|
+
|
|
|
|
+=head2 Working with Net::FTP
|
|
|
|
+See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Compressed files and Net::FTP">
|
|
|
|
=head1 SEE ALSO
|
|
|
|
@@ -963,7 +859,6 @@
|
|
L<Archive::Tar|Archive::Tar>,
|
|
L<IO::Zlib|IO::Zlib>
|
|
|
|
-
|
|
For RFC 1950, 1951 and 1952 see
|
|
F<http://www.faqs.org/rfcs/rfc1950.html>,
|
|
F<http://www.faqs.org/rfcs/rfc1951.html> and
|
|
@@ -977,24 +872,18 @@
|
|
|
|
The primary site for gzip is F<http://www.gzip.org>.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head1 AUTHOR
|
|
|
|
This module was written by Paul Marquess, F<pmqs@cpan.org>.
|
|
|
|
-
|
|
-
|
|
=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 -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -9,7 +9,7 @@
|
|
our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names);
|
|
our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
|
|
@ISA = qw(Exporter);
|
|
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -8,12 +8,12 @@
|
|
use bytes;
|
|
|
|
|
|
-use IO::Compress::RawDeflate 2.008 ;
|
|
+use IO::Compress::RawDeflate 2.015 ;
|
|
|
|
-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.015 ;
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status :Parse createSelfTiedObject);
|
|
+use IO::Compress::Gzip::Constants 2.015 ;
|
|
+use IO::Compress::Zlib::Extra 2.015 ;
|
|
|
|
BEGIN
|
|
{
|
|
@@ -27,7 +27,7 @@
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
$GzipError = '' ;
|
|
|
|
@ISA = qw(Exporter IO::Compress::RawDeflate);
|
|
@@ -274,8 +274,6 @@
|
|
|
|
=head1 NAME
|
|
|
|
-
|
|
-
|
|
IO::Compress::Gzip - Write RFC 1952 files/buffers
|
|
|
|
|
|
@@ -284,7 +282,6 @@
|
|
|
|
use IO::Compress::Gzip qw(gzip $GzipError) ;
|
|
|
|
-
|
|
my $status = gzip $input => $output [,OPTS]
|
|
or die "gzip failed: $GzipError\n";
|
|
|
|
@@ -326,27 +323,15 @@
|
|
|
|
=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<IO::Uncompress::Gunzip|IO::Uncompress::Gunzip>.
|
|
|
|
-
|
|
=head1 Functional Interface
|
|
|
|
A top-level function, C<gzip>, is provided to carry out
|
|
@@ -359,14 +344,10 @@
|
|
gzip $input => $output [,OPTS]
|
|
or die "gzip failed: $GzipError\n";
|
|
|
|
-
|
|
-
|
|
The functional interface needs Perl5.005 or better.
|
|
|
|
-
|
|
=head2 gzip $input => $output [, OPTS]
|
|
|
|
-
|
|
C<gzip> expects at least two parameters, C<$input> and C<$output>.
|
|
|
|
=head3 The C<$input> parameter
|
|
@@ -405,8 +386,6 @@
|
|
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 @@
|
|
|
|
See L<File::GlobMapper|File::GlobMapper> for more details.
|
|
|
|
-
|
|
=back
|
|
|
|
If the C<$input> parameter is any other type, C<undef> will be returned.
|
|
|
|
-
|
|
In addition, if C<$input> is a simple filename, the default values for
|
|
the C<Name> and C<Time> options will be sourced from that file.
|
|
|
|
@@ -430,8 +407,6 @@
|
|
explicitly setting the C<Name> and C<Time> options or by setting the
|
|
C<Minimal> parameter.
|
|
|
|
-
|
|
-
|
|
=head3 The C<$output> parameter
|
|
|
|
The parameter C<$output> is used to control the destination of the
|
|
@@ -451,14 +426,11 @@
|
|
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
|
|
@@ -477,21 +449,12 @@
|
|
|
|
If the C<$output> parameter is any other type, C<undef> 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<gzip>,
|
|
@@ -511,27 +474,18 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< BinModeIn => 0|1 >>
|
|
|
|
When reading from a file or filehandle, set C<binmode> before reading.
|
|
|
|
Defaults to 0.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< Append => 0|1 >>
|
|
|
|
TODO
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
-
|
|
-
|
|
=head2 Examples
|
|
|
|
To read the contents of the file C<file1.txt> and write the compressed
|
|
@@ -545,7 +499,6 @@
|
|
gzip $input => "$input.gz"
|
|
or die "gzip failed: $GzipError\n";
|
|
|
|
-
|
|
To read from an existing Perl filehandle, C<$input>, and write the
|
|
compressed data to a buffer, C<$buffer>.
|
|
|
|
@@ -583,7 +536,6 @@
|
|
or die "Error compressing '$input': $GzipError\n";
|
|
}
|
|
|
|
-
|
|
=head1 OO Interface
|
|
|
|
=head2 Constructor
|
|
@@ -623,7 +575,6 @@
|
|
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
|
|
@@ -679,23 +630,15 @@
|
|
|
|
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 1952 data stream.
|
|
|
|
-
|
|
-
|
|
There are a number of other limitations with the C<Merge> option:
|
|
|
|
=over 5
|
|
@@ -712,11 +655,8 @@
|
|
|
|
=back
|
|
|
|
-
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
-
|
|
=item -Level
|
|
|
|
Defines the compression level used by zlib. The value should either be
|
|
@@ -749,11 +689,6 @@
|
|
|
|
The default is Z_DEFAULT_STRATEGY.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< Minimal => 0|1 >>
|
|
|
|
If specified, this option will force the creation of the smallest possible
|
|
@@ -881,12 +816,8 @@
|
|
If C<< Level => Z_BEST_COMPRESSION >> has been specified then XFL is set to 4.
|
|
Otherwise XFL is set to 0.
|
|
|
|
-
|
|
-
|
|
=item C<< Strict => 0|1 >>
|
|
|
|
-
|
|
-
|
|
C<Strict> will optionally police the values supplied with other options
|
|
to ensure they are compliant with RFC1952.
|
|
|
|
@@ -956,8 +887,6 @@
|
|
|
|
=back
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
=head2 Examples
|
|
@@ -1019,14 +948,11 @@
|
|
|
|
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<Z_FINISH>. Other valid values for C<$flush_type> are
|
|
@@ -1036,10 +962,8 @@
|
|
can seriously degrade the level of compression achieved. See the C<zlib>
|
|
documentation for details.
|
|
|
|
-
|
|
Returns true on success.
|
|
|
|
-
|
|
=head2 tell
|
|
|
|
Usage is
|
|
@@ -1056,28 +980,19 @@
|
|
$z->eof();
|
|
eof($z);
|
|
|
|
-
|
|
-
|
|
Returns true if the C<close> method has been called.
|
|
|
|
-
|
|
-
|
|
=head2 seek
|
|
|
|
$z->seek($position, $whence);
|
|
seek($z, $position, $whence);
|
|
|
|
-
|
|
-
|
|
-
|
|
Provides a sub-set of the C<seek> 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.
|
|
|
|
@@ -1119,33 +1034,27 @@
|
|
$z->input_line_number()
|
|
$z->input_line_number(EXPR)
|
|
|
|
-
|
|
This method always returns C<undef> 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<fileno>
|
|
+will return the underlying file descriptor. Once the C<close> method is
|
|
+called C<fileno> will return C<undef>.
|
|
|
|
-If the C<$z> object is is associated with a buffer, this method will
|
|
-return undef.
|
|
+If the C<$z> object is is associated with a buffer, this method will return
|
|
+C<undef>.
|
|
|
|
=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::Gzip object is destroyed (either explicitly or by the
|
|
variable with the reference to the object going out of scope). The
|
|
@@ -1164,9 +1073,6 @@
|
|
object was created, and the object is associated with a file, the
|
|
underlying file will also be closed.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 newStream([OPTS])
|
|
|
|
Usage is
|
|
@@ -1180,7 +1086,6 @@
|
|
|
|
See the L</"Constructor Options"> section for more details.
|
|
|
|
-
|
|
=head2 deflateParams
|
|
|
|
Usage is
|
|
@@ -1189,20 +1094,15 @@
|
|
|
|
TODO
|
|
|
|
-
|
|
=head1 Importing
|
|
|
|
-
|
|
A number of symbolic constants are required by some methods in
|
|
C<IO::Compress::Gzip>. None are imported by default.
|
|
|
|
-
|
|
-
|
|
=over 5
|
|
|
|
=item :all
|
|
|
|
-
|
|
Imports C<gzip>, C<$GzipError> and all symbolic
|
|
constants that can be used by C<IO::Compress::Gzip>. Same as doing this
|
|
|
|
@@ -1212,10 +1112,8 @@
|
|
|
|
Import all symbolic constants. Same as doing this
|
|
|
|
-
|
|
use IO::Compress::Gzip qw(:flush :level :strategy) ;
|
|
|
|
-
|
|
=item :flush
|
|
|
|
These symbolic constants are used by the C<flush> method.
|
|
@@ -1236,7 +1134,6 @@
|
|
Z_BEST_COMPRESSION
|
|
Z_DEFAULT_COMPRESSION
|
|
|
|
-
|
|
=item :strategy
|
|
|
|
These symbolic constants are used by the C<Strategy> option in the constructor.
|
|
@@ -1252,21 +1149,17 @@
|
|
|
|
=back
|
|
|
|
-For
|
|
-
|
|
=head1 EXAMPLES
|
|
|
|
-TODO
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
+=head2 Apache::GZip Revisited
|
|
|
|
+See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Apache::GZip Revisited">
|
|
|
|
+
|
|
|
|
+=head2 Working with Net::FTP
|
|
|
|
+See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Compressed files and Net::FTP">
|
|
|
|
=head1 SEE ALSO
|
|
|
|
@@ -1278,7 +1171,6 @@
|
|
L<Archive::Tar|Archive::Tar>,
|
|
L<IO::Zlib|IO::Zlib>
|
|
|
|
-
|
|
For RFC 1950, 1951 and 1952 see
|
|
F<http://www.faqs.org/rfcs/rfc1950.html>,
|
|
F<http://www.faqs.org/rfcs/rfc1951.html> and
|
|
@@ -1292,24 +1184,18 @@
|
|
|
|
The primary site for gzip is F<http://www.gzip.org>.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head1 AUTHOR
|
|
|
|
This module was written by Paul Marquess, F<pmqs@cpan.org>.
|
|
|
|
-
|
|
-
|
|
=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 -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -7,16 +7,16 @@
|
|
use bytes;
|
|
|
|
|
|
-use IO::Compress::Base 2.008 ;
|
|
-use IO::Compress::Base::Common 2.008 qw(:Status createSelfTiedObject);
|
|
-use IO::Compress::Adapter::Deflate 2.008 ;
|
|
+use IO::Compress::Base 2.015 ;
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
|
|
+use IO::Compress::Adapter::Deflate 2.015 ;
|
|
|
|
require Exporter ;
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
$RawDeflateError = '';
|
|
|
|
@ISA = qw(Exporter IO::Compress::Base);
|
|
@@ -92,7 +92,6 @@
|
|
sub mkComp
|
|
{
|
|
my $self = shift ;
|
|
- my $class = shift ;
|
|
my $got = shift ;
|
|
|
|
my ($obj, $errstr, $errno) = IO::Compress::Adapter::Deflate::mkCompObject(
|
|
@@ -143,8 +142,8 @@
|
|
{
|
|
my $self = shift ;
|
|
|
|
- use IO::Compress::Base::Common 2.008 qw(:Parse);
|
|
- use Compress::Raw::Zlib 2.008 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
|
|
+ use IO::Compress::Base::Common 2.015 qw(:Parse);
|
|
+ use Compress::Raw::Zlib 2.015 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
|
|
|
|
|
|
return (
|
|
@@ -251,8 +250,6 @@
|
|
|
|
=head1 NAME
|
|
|
|
-
|
|
-
|
|
IO::Compress::RawDeflate - Write RFC 1951 files/buffers
|
|
|
|
|
|
@@ -261,7 +258,6 @@
|
|
|
|
use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
|
|
|
|
-
|
|
my $status = rawdeflate $input => $output [,OPTS]
|
|
or die "rawdeflate failed: $RawDeflateError\n";
|
|
|
|
@@ -303,27 +299,15 @@
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
-
|
|
This module provides a Perl interface that allows writing compressed
|
|
data to files or buffer as defined in RFC 1951.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
Note that RFC 1951 data is not a good choice of compression format
|
|
to use in isolation, especially if you want to auto-detect it.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
For reading RFC 1951 files/buffers, see the companion module
|
|
L<IO::Uncompress::RawInflate|IO::Uncompress::RawInflate>.
|
|
|
|
-
|
|
=head1 Functional Interface
|
|
|
|
A top-level function, C<rawdeflate>, is provided to carry out
|
|
@@ -336,14 +320,10 @@
|
|
rawdeflate $input => $output [,OPTS]
|
|
or die "rawdeflate failed: $RawDeflateError\n";
|
|
|
|
-
|
|
-
|
|
The functional interface needs Perl5.005 or better.
|
|
|
|
-
|
|
=head2 rawdeflate $input => $output [, OPTS]
|
|
|
|
-
|
|
C<rawdeflate> expects at least two parameters, C<$input> and C<$output>.
|
|
|
|
=head3 The C<$input> parameter
|
|
@@ -382,8 +362,6 @@
|
|
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 ">"
|
|
@@ -394,13 +372,10 @@
|
|
|
|
See L<File::GlobMapper|File::GlobMapper> for more details.
|
|
|
|
-
|
|
=back
|
|
|
|
If the C<$input> parameter is any other type, C<undef> will be returned.
|
|
|
|
-
|
|
-
|
|
=head3 The C<$output> parameter
|
|
|
|
The parameter C<$output> is used to control the destination of the
|
|
@@ -420,14 +395,11 @@
|
|
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
|
|
@@ -446,21 +418,12 @@
|
|
|
|
If the C<$output> parameter is any other type, C<undef> 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<rawdeflate>,
|
|
@@ -480,27 +443,18 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< BinModeIn => 0|1 >>
|
|
|
|
When reading from a file or filehandle, set C<binmode> before reading.
|
|
|
|
Defaults to 0.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< Append => 0|1 >>
|
|
|
|
TODO
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
-
|
|
-
|
|
=head2 Examples
|
|
|
|
To read the contents of the file C<file1.txt> and write the compressed
|
|
@@ -514,7 +468,6 @@
|
|
rawdeflate $input => "$input.1951"
|
|
or die "rawdeflate failed: $RawDeflateError\n";
|
|
|
|
-
|
|
To read from an existing Perl filehandle, C<$input>, and write the
|
|
compressed data to a buffer, C<$buffer>.
|
|
|
|
@@ -552,7 +505,6 @@
|
|
or die "Error compressing '$input': $RawDeflateError\n";
|
|
}
|
|
|
|
-
|
|
=head1 OO Interface
|
|
|
|
=head2 Constructor
|
|
@@ -592,7 +544,6 @@
|
|
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
|
|
@@ -648,23 +599,15 @@
|
|
|
|
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 1951 data stream.
|
|
|
|
-
|
|
-
|
|
There are a number of other limitations with the C<Merge> option:
|
|
|
|
=over 5
|
|
@@ -681,11 +624,8 @@
|
|
|
|
=back
|
|
|
|
-
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
-
|
|
=item -Level
|
|
|
|
Defines the compression level used by zlib. The value should either be
|
|
@@ -718,19 +658,10 @@
|
|
|
|
The default is Z_DEFAULT_STRATEGY.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< Strict => 0|1 >>
|
|
|
|
-
|
|
-
|
|
This is a placeholder option.
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
=head2 Examples
|
|
@@ -792,14 +723,11 @@
|
|
|
|
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<Z_FINISH>. Other valid values for C<$flush_type> are
|
|
@@ -809,10 +737,8 @@
|
|
can seriously degrade the level of compression achieved. See the C<zlib>
|
|
documentation for details.
|
|
|
|
-
|
|
Returns true on success.
|
|
|
|
-
|
|
=head2 tell
|
|
|
|
Usage is
|
|
@@ -829,28 +755,19 @@
|
|
$z->eof();
|
|
eof($z);
|
|
|
|
-
|
|
-
|
|
Returns true if the C<close> method has been called.
|
|
|
|
-
|
|
-
|
|
=head2 seek
|
|
|
|
$z->seek($position, $whence);
|
|
seek($z, $position, $whence);
|
|
|
|
-
|
|
-
|
|
-
|
|
Provides a sub-set of the C<seek> 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.
|
|
|
|
@@ -892,33 +809,27 @@
|
|
$z->input_line_number()
|
|
$z->input_line_number(EXPR)
|
|
|
|
-
|
|
This method always returns C<undef> 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<fileno>
|
|
+will return the underlying file descriptor. Once the C<close> method is
|
|
+called C<fileno> will return C<undef>.
|
|
|
|
-If the C<$z> object is is associated with a buffer, this method will
|
|
-return undef.
|
|
+If the C<$z> object is is associated with a buffer, this method will return
|
|
+C<undef>.
|
|
|
|
=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::RawDeflate object is destroyed (either explicitly or by the
|
|
variable with the reference to the object going out of scope). The
|
|
@@ -937,9 +848,6 @@
|
|
object was created, and the object is associated with a file, the
|
|
underlying file will also be closed.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 newStream([OPTS])
|
|
|
|
Usage is
|
|
@@ -953,7 +861,6 @@
|
|
|
|
See the L</"Constructor Options"> section for more details.
|
|
|
|
-
|
|
=head2 deflateParams
|
|
|
|
Usage is
|
|
@@ -962,20 +869,15 @@
|
|
|
|
TODO
|
|
|
|
-
|
|
=head1 Importing
|
|
|
|
-
|
|
A number of symbolic constants are required by some methods in
|
|
C<IO::Compress::RawDeflate>. None are imported by default.
|
|
|
|
-
|
|
-
|
|
=over 5
|
|
|
|
=item :all
|
|
|
|
-
|
|
Imports C<rawdeflate>, C<$RawDeflateError> and all symbolic
|
|
constants that can be used by C<IO::Compress::RawDeflate>. Same as doing this
|
|
|
|
@@ -985,10 +887,8 @@
|
|
|
|
Import all symbolic constants. Same as doing this
|
|
|
|
-
|
|
use IO::Compress::RawDeflate qw(:flush :level :strategy) ;
|
|
|
|
-
|
|
=item :flush
|
|
|
|
These symbolic constants are used by the C<flush> method.
|
|
@@ -1009,7 +909,6 @@
|
|
Z_BEST_COMPRESSION
|
|
Z_DEFAULT_COMPRESSION
|
|
|
|
-
|
|
=item :strategy
|
|
|
|
These symbolic constants are used by the C<Strategy> option in the constructor.
|
|
@@ -1025,21 +924,17 @@
|
|
|
|
=back
|
|
|
|
-For
|
|
-
|
|
=head1 EXAMPLES
|
|
|
|
-TODO
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
+=head2 Apache::GZip Revisited
|
|
|
|
+See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Apache::GZip Revisited">
|
|
|
|
+
|
|
|
|
+=head2 Working with Net::FTP
|
|
|
|
+See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Compressed files and Net::FTP">
|
|
|
|
=head1 SEE ALSO
|
|
|
|
@@ -1051,7 +946,6 @@
|
|
L<Archive::Tar|Archive::Tar>,
|
|
L<IO::Zlib|IO::Zlib>
|
|
|
|
-
|
|
For RFC 1950, 1951 and 1952 see
|
|
F<http://www.faqs.org/rfcs/rfc1950.html>,
|
|
F<http://www.faqs.org/rfcs/rfc1951.html> and
|
|
@@ -1065,24 +959,18 @@
|
|
|
|
The primary site for gzip is F<http://www.gzip.org>.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head1 AUTHOR
|
|
|
|
This module was written by Paul Marquess, F<pmqs@cpan.org>.
|
|
|
|
-
|
|
-
|
|
=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 -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -7,7 +7,7 @@
|
|
|
|
our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
|
|
@ISA = qw(Exporter);
|
|
|
|
@@ -17,6 +17,7 @@
|
|
ZIP_CM_DEFLATE
|
|
ZIP_CM_BZIP2
|
|
ZIP_CM_LZMA
|
|
+ ZIP_CM_PPMD
|
|
|
|
ZIP_LOCAL_HDR_SIG
|
|
ZIP_DATA_HDR_SIG
|
|
@@ -32,6 +33,7 @@
|
|
ZIP_GP_FLAG_PATCHED_MASK
|
|
ZIP_GP_FLAG_STRONG_ENCRYPTED_MASK
|
|
ZIP_GP_FLAG_LZMA_EOS_PRESENT
|
|
+ ZIP_GP_FLAG_LANGUAGE_ENCODING
|
|
|
|
ZIP_EXTRA_ID_ZIP64
|
|
ZIP_EXTRA_ID_EXT_TIMESTAMP
|
|
@@ -52,13 +54,15 @@
|
|
use constant ZIP_CM_DEFLATE => 8 ;
|
|
use constant ZIP_CM_BZIP2 => 12 ;
|
|
use constant ZIP_CM_LZMA => 14 ; # Not Supported yet
|
|
+use constant ZIP_CM_PPMD => 98 ; # Not Supported yet
|
|
|
|
# General Purpose Flag
|
|
-use constant ZIP_GP_FLAG_ENCRYPTED_MASK => 1 ;
|
|
-use constant ZIP_GP_FLAG_STREAMING_MASK => 8 ;
|
|
-use constant ZIP_GP_FLAG_PATCHED_MASK => 32 ;
|
|
-use constant ZIP_GP_FLAG_STRONG_ENCRYPTED_MASK => 64 ;
|
|
-use constant ZIP_GP_FLAG_LZMA_EOS_PRESENT => 2 ;
|
|
+use constant ZIP_GP_FLAG_ENCRYPTED_MASK => (1 << 0) ;
|
|
+use constant ZIP_GP_FLAG_STREAMING_MASK => (1 << 3) ;
|
|
+use constant ZIP_GP_FLAG_PATCHED_MASK => (1 << 5) ;
|
|
+use constant ZIP_GP_FLAG_STRONG_ENCRYPTED_MASK => (1 << 6) ;
|
|
+use constant ZIP_GP_FLAG_LZMA_EOS_PRESENT => (1 << 1) ;
|
|
+use constant ZIP_GP_FLAG_LANGUAGE_ENCODING => (1 << 11) ;
|
|
|
|
# Internal File Attributes
|
|
use constant ZIP_IFA_TEXT_MASK => 1;
|
|
@@ -80,6 +84,8 @@
|
|
use constant ZIP_EXTRA_ID_ZIP64 => pack "v", 1;
|
|
use constant ZIP_EXTRA_ID_EXT_TIMESTAMP => "UT";
|
|
use constant ZIP_EXTRA_ID_INFO_ZIP_UNIX2 => "Ux";
|
|
+use constant ZIP_EXTRA_ID_INFO_ZIP_UNIXn => "ux";
|
|
+use constant ZIP_EXTRA_ID_JAVA_EXE => pack "v", 0xCAFE;
|
|
|
|
use constant ZIP64_MIN_VERSION => 45;
|
|
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -4,21 +4,21 @@
|
|
use warnings;
|
|
use bytes;
|
|
|
|
-use IO::Compress::Base::Common 2.008 qw(:Status createSelfTiedObject);
|
|
-use IO::Compress::RawDeflate 2.008 ;
|
|
-use IO::Compress::Adapter::Deflate 2.008 ;
|
|
-use IO::Compress::Adapter::Identity 2.008 ;
|
|
-use IO::Compress::Zlib::Extra 2.008 ;
|
|
-use IO::Compress::Zip::Constants 2.008 ;
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
|
|
+use IO::Compress::RawDeflate 2.015 ;
|
|
+use IO::Compress::Adapter::Deflate 2.015 ;
|
|
+use IO::Compress::Adapter::Identity 2.015 ;
|
|
+use IO::Compress::Zlib::Extra 2.015 ;
|
|
+use IO::Compress::Zip::Constants 2.015 ;
|
|
|
|
|
|
-use Compress::Raw::Zlib 2.008 qw(crc32) ;
|
|
+use Compress::Raw::Zlib 2.015 qw(crc32) ;
|
|
BEGIN
|
|
{
|
|
eval { require IO::Compress::Adapter::Bzip2 ;
|
|
- import IO::Compress::Adapter::Bzip2 2.008 ;
|
|
+ import IO::Compress::Adapter::Bzip2 2.015 ;
|
|
require IO::Compress::Bzip2 ;
|
|
- import IO::Compress::Bzip2 2.008 ;
|
|
+ import IO::Compress::Bzip2 2.015 ;
|
|
} ;
|
|
}
|
|
|
|
@@ -27,7 +27,7 @@
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
$ZipError = '';
|
|
|
|
@ISA = qw(Exporter IO::Compress::RawDeflate);
|
|
@@ -57,7 +57,6 @@
|
|
sub mkComp
|
|
{
|
|
my $self = shift ;
|
|
- my $class = shift ;
|
|
my $got = shift ;
|
|
|
|
my ($obj, $errstr, $errno) ;
|
|
@@ -141,6 +140,10 @@
|
|
my $empty = 0;
|
|
my $osCode = $param->value('OS_Code') ;
|
|
my $extFileAttr = 0 ;
|
|
+
|
|
+ # This code assumes Unix.
|
|
+ $extFileAttr = 0666 << 16
|
|
+ if $osCode == ZIP_OS_CODE_UNIX ;
|
|
|
|
if (*$self->{ZipData}{Zip64}) {
|
|
$empty = 0xFFFF;
|
|
@@ -172,10 +175,6 @@
|
|
$ctlExtra .= mkUnix2Extra();
|
|
}
|
|
|
|
- # TODO - this code assumes Unix.
|
|
- #$extFileAttr = 0666 << 16
|
|
- # if $osCode == ZIP_OS_CODE_UNIX ;
|
|
-
|
|
$extFileAttr = $param->value('ExtAttr')
|
|
if defined $param->value('ExtAttr') ;
|
|
|
|
@@ -392,6 +391,18 @@
|
|
$got->value("ATime", $timeRef->[0]);
|
|
$got->value("CTime", $timeRef->[2]);
|
|
}
|
|
+
|
|
+ # Unix2 Extended Attribute
|
|
+ if (! $got->parsed('exUnix2') ) {
|
|
+ my $timeRef = $got->value('exUnix2');
|
|
+ if ( defined $timeRef) {
|
|
+ return $self->saveErrorString(undef, "exUnix2 not a 2-element array ref")
|
|
+ if ref $timeRef ne 'ARRAY' || @$timeRef != 2;
|
|
+ }
|
|
+
|
|
+ $got->value("UID", $timeRef->[0]);
|
|
+ $got->value("GID", $timeRef->[1]);
|
|
+ }
|
|
|
|
*$self->{ZipData}{Zip64} = $got->value('Zip64');
|
|
*$self->{ZipData}{Stream} = $got->value('Stream');
|
|
@@ -441,8 +452,8 @@
|
|
{
|
|
my $self = shift ;
|
|
|
|
- use IO::Compress::Base::Common 2.008 qw(:Parse);
|
|
- use Compress::Raw::Zlib 2.008 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
|
|
+ use IO::Compress::Base::Common 2.015 qw(:Parse);
|
|
+ use Compress::Raw::Zlib 2.015 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
|
|
|
|
my @Bzip2 = ();
|
|
|
|
@@ -465,6 +476,7 @@
|
|
'Name' => [0, 1, Parse_any, ''],
|
|
'Time' => [0, 1, Parse_any, undef],
|
|
'exTime' => [0, 1, Parse_any, undef],
|
|
+ 'exUnix2' => [0, 1, Parse_any, undef],
|
|
'ExtAttr' => [0, 1, Parse_any, 0],
|
|
'OS_Code' => [0, 1, Parse_unsigned, $Compress::Raw::Zlib::gzip_os_code],
|
|
|
|
@@ -504,6 +516,7 @@
|
|
$params->value('CTime' => undef) ; # No Creation time
|
|
}
|
|
|
|
+ # NOTE - Unix specific code alert
|
|
$params->value('ExtAttr' => $mode << 16)
|
|
if ! $params->parsed('ExtAttr');
|
|
|
|
@@ -570,8 +583,6 @@
|
|
|
|
=head1 NAME
|
|
|
|
-
|
|
-
|
|
IO::Compress::Zip - Write zip files/buffers
|
|
|
|
|
|
@@ -580,7 +591,6 @@
|
|
|
|
use IO::Compress::Zip qw(zip $ZipError) ;
|
|
|
|
-
|
|
my $status = zip $input => $output [,OPTS]
|
|
or die "zip failed: $ZipError\n";
|
|
|
|
@@ -622,18 +632,9 @@
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
-
|
|
This module provides a Perl interface that allows writing zip
|
|
compressed data to files or buffer.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
The primary purpose of this module is to provide streaming write access to
|
|
zip files and buffers. It is not a general-purpose file archiver. If that
|
|
is what you want, check out C<Archive::Zip>.
|
|
@@ -644,13 +645,9 @@
|
|
Note that to create Bzip2 content, the module C<IO::Compress::Bzip2> must
|
|
be installed.
|
|
|
|
-
|
|
-
|
|
-
|
|
For reading zip files/buffers, see the companion module
|
|
L<IO::Uncompress::Unzip|IO::Uncompress::Unzip>.
|
|
|
|
-
|
|
=head1 Functional Interface
|
|
|
|
A top-level function, C<zip>, is provided to carry out
|
|
@@ -663,14 +660,10 @@
|
|
zip $input => $output [,OPTS]
|
|
or die "zip failed: $ZipError\n";
|
|
|
|
-
|
|
-
|
|
The functional interface needs Perl5.005 or better.
|
|
|
|
-
|
|
=head2 zip $input => $output [, OPTS]
|
|
|
|
-
|
|
C<zip> expects at least two parameters, C<$input> and C<$output>.
|
|
|
|
=head3 The C<$input> parameter
|
|
@@ -709,8 +702,6 @@
|
|
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 ">"
|
|
@@ -721,12 +712,10 @@
|
|
|
|
See L<File::GlobMapper|File::GlobMapper> for more details.
|
|
|
|
-
|
|
=back
|
|
|
|
If the C<$input> parameter is any other type, C<undef> will be returned.
|
|
|
|
-
|
|
In addition, if C<$input> is a simple filename, the default values for
|
|
the C<Name>, C<Time>, C<ExtAttr> and C<exTime> options will be sourced from that file.
|
|
|
|
@@ -734,8 +723,6 @@
|
|
explicitly setting the C<Name>, C<Time>, C<ExtAttr> and C<exTime> options or by setting the
|
|
C<Minimal> parameter.
|
|
|
|
-
|
|
-
|
|
=head3 The C<$output> parameter
|
|
|
|
The parameter C<$output> is used to control the destination of the
|
|
@@ -755,14 +742,11 @@
|
|
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
|
|
@@ -781,21 +765,12 @@
|
|
|
|
If the C<$output> parameter is any other type, C<undef> 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 each be stored
|
|
in C<$output> as a distinct entry.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=head2 Optional Parameters
|
|
|
|
Unless specified below, the optional parameters for C<zip>,
|
|
@@ -815,27 +790,18 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< BinModeIn => 0|1 >>
|
|
|
|
When reading from a file or filehandle, set C<binmode> before reading.
|
|
|
|
Defaults to 0.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< Append => 0|1 >>
|
|
|
|
TODO
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
-
|
|
-
|
|
=head2 Examples
|
|
|
|
To read the contents of the file C<file1.txt> and write the compressed
|
|
@@ -849,7 +815,6 @@
|
|
zip $input => "$input.zip"
|
|
or die "zip failed: $ZipError\n";
|
|
|
|
-
|
|
To read from an existing Perl filehandle, C<$input>, and write the
|
|
compressed data to a buffer, C<$buffer>.
|
|
|
|
@@ -887,7 +852,6 @@
|
|
or die "Error compressing '$input': $ZipError\n";
|
|
}
|
|
|
|
-
|
|
=head1 OO Interface
|
|
|
|
=head2 Constructor
|
|
@@ -927,7 +891,6 @@
|
|
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
|
|
@@ -983,8 +946,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
-
|
|
=item C<< Name => $string >>
|
|
|
|
Stores the contents of C<$string> in the zip filename header field. If
|
|
@@ -1002,7 +963,14 @@
|
|
This option controls the "external file attributes" field in the central
|
|
header of the zip file. This is a 4 byte field.
|
|
|
|
-This option defaults to 0.
|
|
+If you are running a Unix derivative this value defaults to
|
|
+
|
|
+ 0666 << 16
|
|
+
|
|
+This should allow read/write access to any files that are extracted from
|
|
+the zip file/buffer.
|
|
+
|
|
+For all other systems it defaults to 0.
|
|
|
|
=item C<< exTime => [$atime, $mtime, $ctime] >>
|
|
|
|
@@ -1010,9 +978,10 @@
|
|
C<$atime>, C<mtime> and C<$ctime>. These correspond to the last access
|
|
time, last modification time and creation time respectively.
|
|
|
|
-It uses these values to set the extended timestamp field in the local zip
|
|
-header to the three values, $atime, $mtime, $ctime and sets the extended
|
|
-timestamp field in the central zip header to C<$mtime>.
|
|
+It uses these values to set the extended timestamp field (ID is "UT") in
|
|
+the local zip header using the three values, $atime, $mtime, $ctime. In
|
|
+addition it sets the extended timestamp field in the central zip header
|
|
+using C<$mtime>.
|
|
|
|
If any of the three values is C<undef> that time value will not be used.
|
|
So, for example, to set only the C<$mtime> you would use this
|
|
@@ -1023,6 +992,21 @@
|
|
|
|
By default no extended time field is created.
|
|
|
|
+=item C<< exUnix2 => [$uid, $gid] >>
|
|
+
|
|
+This option expects an array reference with exactly two elements: C<$uid>
|
|
+and C<$gid>. These values correspond to the numeric user ID and group ID
|
|
+of the owner of the files respectively.
|
|
+
|
|
+When the C<exUnix2> option is present it will trigger the creation of a
|
|
+Unix2 extra field (ID is "Ux") in the local zip. This will be populated
|
|
+with C<$uid> and C<$gid>. In addition an empty Unix2 extra field will also
|
|
+be created in the central zip header
|
|
+
|
|
+If the C<Minimal> option is set to true, this option will be ignored.
|
|
+
|
|
+By default no Unix2 extra field is created.
|
|
+
|
|
=item C<< Comment => $comment >>
|
|
|
|
Stores the contents of C<$comment> in the Central File Header of
|
|
@@ -1096,8 +1080,9 @@
|
|
=item C<< ExtraFieldLocal => $data >>
|
|
=item C<< ExtraFieldCentral => $data >>
|
|
|
|
-These options allows additional metadata to be stored in the local and
|
|
-central headers in the zip file/buffer.
|
|
+The C<ExtraFieldLocal> option is used to store additional metadata in the
|
|
+local header for the zip file/buffer. The C<ExtraFieldCentral> does the
|
|
+same for the matching central header.
|
|
|
|
An extra field consists of zero or more subfields. Each subfield consists
|
|
of a two byte header followed by the subfield data.
|
|
@@ -1129,10 +1114,9 @@
|
|
|
|
ExtraField => $rawdata
|
|
|
|
-The Extended Time field, set using the C<exTime> option, is an example of
|
|
-an extended field.
|
|
-
|
|
-
|
|
+The Extended Time field (ID "UT"), set using the C<exTime> option, and the
|
|
+Unix2 extra field (ID "Ux), set using the C<exUnix2> option, are examples
|
|
+of extra fields.
|
|
|
|
If the C<Minimal> option is set to true, this option will be ignored.
|
|
|
|
@@ -1140,9 +1124,9 @@
|
|
|
|
=item C<< Minimal => 1|0 >>
|
|
|
|
-If specified, this option will disable the creation of all extended fields
|
|
-in the zip local and central headers. So the C<exTime>, C<ExtraFieldLocal>
|
|
-and C<ExtraFieldCentral> options will be ignored.
|
|
+If specified, this option will disable the creation of all extra fields
|
|
+in the zip local and central headers. So the C<exTime>, C<exUnix2>,
|
|
+C<ExtraFieldLocal> and C<ExtraFieldCentral> options will be ignored.
|
|
|
|
This parameter defaults to 0.
|
|
|
|
@@ -1169,9 +1153,6 @@
|
|
|
|
The default is 0.
|
|
|
|
-
|
|
-
|
|
-
|
|
=item -Level
|
|
|
|
Defines the compression level used by zlib. The value should either be
|
|
@@ -1204,19 +1185,10 @@
|
|
|
|
The default is Z_DEFAULT_STRATEGY.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< Strict => 0|1 >>
|
|
|
|
-
|
|
-
|
|
This is a placeholder option.
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
=head2 Examples
|
|
@@ -1278,14 +1250,11 @@
|
|
|
|
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<Z_FINISH>. Other valid values for C<$flush_type> are
|
|
@@ -1295,10 +1264,8 @@
|
|
can seriously degrade the level of compression achieved. See the C<zlib>
|
|
documentation for details.
|
|
|
|
-
|
|
Returns true on success.
|
|
|
|
-
|
|
=head2 tell
|
|
|
|
Usage is
|
|
@@ -1315,28 +1282,19 @@
|
|
$z->eof();
|
|
eof($z);
|
|
|
|
-
|
|
-
|
|
Returns true if the C<close> method has been called.
|
|
|
|
-
|
|
-
|
|
=head2 seek
|
|
|
|
$z->seek($position, $whence);
|
|
seek($z, $position, $whence);
|
|
|
|
-
|
|
-
|
|
-
|
|
Provides a sub-set of the C<seek> 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.
|
|
|
|
@@ -1378,33 +1336,27 @@
|
|
$z->input_line_number()
|
|
$z->input_line_number(EXPR)
|
|
|
|
-
|
|
This method always returns C<undef> 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<fileno>
|
|
+will return the underlying file descriptor. Once the C<close> method is
|
|
+called C<fileno> will return C<undef>.
|
|
|
|
-If the C<$z> object is is associated with a buffer, this method will
|
|
-return undef.
|
|
+If the C<$z> object is is associated with a buffer, this method will return
|
|
+C<undef>.
|
|
|
|
=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::Zip object is destroyed (either explicitly or by the
|
|
variable with the reference to the object going out of scope). The
|
|
@@ -1423,9 +1375,6 @@
|
|
object was created, and the object is associated with a file, the
|
|
underlying file will also be closed.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 newStream([OPTS])
|
|
|
|
Usage is
|
|
@@ -1439,7 +1388,6 @@
|
|
|
|
See the L</"Constructor Options"> section for more details.
|
|
|
|
-
|
|
=head2 deflateParams
|
|
|
|
Usage is
|
|
@@ -1448,20 +1396,15 @@
|
|
|
|
TODO
|
|
|
|
-
|
|
=head1 Importing
|
|
|
|
-
|
|
A number of symbolic constants are required by some methods in
|
|
C<IO::Compress::Zip>. None are imported by default.
|
|
|
|
-
|
|
-
|
|
=over 5
|
|
|
|
=item :all
|
|
|
|
-
|
|
Imports C<zip>, C<$ZipError> and all symbolic
|
|
constants that can be used by C<IO::Compress::Zip>. Same as doing this
|
|
|
|
@@ -1471,10 +1414,8 @@
|
|
|
|
Import all symbolic constants. Same as doing this
|
|
|
|
-
|
|
use IO::Compress::Zip qw(:flush :level :strategy :zip_method) ;
|
|
|
|
-
|
|
=item :flush
|
|
|
|
These symbolic constants are used by the C<flush> method.
|
|
@@ -1495,7 +1436,6 @@
|
|
Z_BEST_COMPRESSION
|
|
Z_DEFAULT_COMPRESSION
|
|
|
|
-
|
|
=item :strategy
|
|
|
|
These symbolic constants are used by the C<Strategy> option in the constructor.
|
|
@@ -1506,7 +1446,6 @@
|
|
Z_FIXED
|
|
Z_DEFAULT_STRATEGY
|
|
|
|
-
|
|
=item :zip_method
|
|
|
|
These symbolic constants are used by the C<Method> option in the
|
|
@@ -1521,21 +1460,17 @@
|
|
|
|
=back
|
|
|
|
-For
|
|
-
|
|
=head1 EXAMPLES
|
|
|
|
-TODO
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
+=head2 Apache::GZip Revisited
|
|
|
|
+See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Apache::GZip Revisited">
|
|
|
|
+
|
|
|
|
+=head2 Working with Net::FTP
|
|
|
|
+See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Compressed files and Net::FTP">
|
|
|
|
=head1 SEE ALSO
|
|
|
|
@@ -1547,7 +1482,6 @@
|
|
L<Archive::Tar|Archive::Tar>,
|
|
L<IO::Zlib|IO::Zlib>
|
|
|
|
-
|
|
For RFC 1950, 1951 and 1952 see
|
|
F<http://www.faqs.org/rfcs/rfc1950.html>,
|
|
F<http://www.faqs.org/rfcs/rfc1951.html> and
|
|
@@ -1561,24 +1495,18 @@
|
|
|
|
The primary site for gzip is F<http://www.gzip.org>.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head1 AUTHOR
|
|
|
|
This module was written by Paul Marquess, F<pmqs@cpan.org>.
|
|
|
|
-
|
|
-
|
|
=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 -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -9,7 +9,7 @@
|
|
|
|
our ($VERSION, @ISA, @EXPORT);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
|
|
@ISA = qw(Exporter);
|
|
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -8,9 +8,9 @@
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
|
|
-use IO::Compress::Gzip::Constants 2.008 ;
|
|
+use IO::Compress::Gzip::Constants 2.015 ;
|
|
|
|
sub ExtraFieldError
|
|
{
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -4,13 +4,13 @@
|
|
use strict;
|
|
use bytes;
|
|
|
|
-use IO::Compress::Base::Common 2.008 qw(:Status);
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status);
|
|
|
|
our ($VERSION);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
|
|
-use Compress::Raw::Zlib 2.008 ();
|
|
+use Compress::Raw::Zlib 2.015 ();
|
|
|
|
sub mkUncompObject
|
|
{
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -4,11 +4,11 @@
|
|
use warnings;
|
|
use bytes;
|
|
|
|
-use IO::Compress::Base::Common 2.008 qw(:Status);
|
|
-use Compress::Raw::Zlib 2.008 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status);
|
|
+use Compress::Raw::Zlib 2.015 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
|
|
|
|
our ($VERSION);
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
|
|
|
|
|
|
diff -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -6,22 +6,22 @@
|
|
use warnings;
|
|
use bytes;
|
|
|
|
-use IO::Compress::Base::Common 2.008 qw(createSelfTiedObject);
|
|
+use IO::Compress::Base::Common 2.015 qw(createSelfTiedObject);
|
|
|
|
-use IO::Uncompress::Adapter::Inflate 2.008 ();
|
|
+use IO::Uncompress::Adapter::Inflate 2.015 ();
|
|
|
|
|
|
-use IO::Uncompress::Base 2.008 ;
|
|
-use IO::Uncompress::Gunzip 2.008 ;
|
|
-use IO::Uncompress::Inflate 2.008 ;
|
|
-use IO::Uncompress::RawInflate 2.008 ;
|
|
-use IO::Uncompress::Unzip 2.008 ;
|
|
+use IO::Uncompress::Base 2.015 ;
|
|
+use IO::Uncompress::Gunzip 2.015 ;
|
|
+use IO::Uncompress::Inflate 2.015 ;
|
|
+use IO::Uncompress::RawInflate 2.015 ;
|
|
+use IO::Uncompress::Unzip 2.015 ;
|
|
|
|
require Exporter ;
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
$AnyInflateError = '';
|
|
|
|
@ISA = qw( Exporter IO::Uncompress::Base );
|
|
@@ -48,7 +48,7 @@
|
|
|
|
sub getExtraParams
|
|
{
|
|
- use IO::Compress::Base::Common 2.008 qw(:Parse);
|
|
+ use IO::Compress::Base::Common 2.015 qw(:Parse);
|
|
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
|
|
}
|
|
|
|
@@ -67,7 +67,6 @@
|
|
sub mkUncomp
|
|
{
|
|
my $self = shift ;
|
|
- my $class = shift ;
|
|
my $got = shift ;
|
|
|
|
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject();
|
|
@@ -127,10 +126,8 @@
|
|
|
|
=head1 NAME
|
|
|
|
-
|
|
IO::Uncompress::AnyInflate - Uncompress zlib-based (zip, gzip) file/buffer
|
|
|
|
-
|
|
=head1 SYNOPSIS
|
|
|
|
use IO::Uncompress::AnyInflate qw(anyinflate $AnyInflateError) ;
|
|
@@ -176,10 +173,8 @@
|
|
eof($z)
|
|
close($z)
|
|
|
|
-
|
|
=head1 DESCRIPTION
|
|
|
|
-
|
|
This module provides a Perl interface that allows the reading of
|
|
files/buffers that have been compressed in a number of formats that use the
|
|
zlib compression library.
|
|
@@ -201,10 +196,6 @@
|
|
The module will auto-detect which, if any, of the supported
|
|
compression formats is being used.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=head1 Functional Interface
|
|
|
|
A top-level function, C<anyinflate>, is provided to carry out
|
|
@@ -217,14 +208,10 @@
|
|
anyinflate $input => $output [,OPTS]
|
|
or die "anyinflate failed: $AnyInflateError\n";
|
|
|
|
-
|
|
-
|
|
The functional interface needs Perl5.005 or better.
|
|
|
|
-
|
|
=head2 anyinflate $input => $output [, OPTS]
|
|
|
|
-
|
|
C<anyinflate> expects at least two parameters, C<$input> and C<$output>.
|
|
|
|
=head3 The C<$input> parameter
|
|
@@ -263,8 +250,6 @@
|
|
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 ">"
|
|
@@ -275,13 +260,10 @@
|
|
|
|
See L<File::GlobMapper|File::GlobMapper> for more details.
|
|
|
|
-
|
|
=back
|
|
|
|
If the C<$input> parameter is any other type, C<undef> will be returned.
|
|
|
|
-
|
|
-
|
|
=head3 The C<$output> parameter
|
|
|
|
The parameter C<$output> is used to control the destination of the
|
|
@@ -301,14 +283,11 @@
|
|
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
|
|
@@ -327,20 +306,13 @@
|
|
|
|
If the C<$output> parameter is any other type, C<undef> 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<anyinflate>,
|
|
@@ -360,7 +332,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< BinModeOut => 0|1 >>
|
|
|
|
When writing to a file or filehandle, set C<binmode> before writing to the
|
|
@@ -368,26 +339,17 @@
|
|
|
|
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
|
|
@@ -407,19 +369,12 @@
|
|
|
|
Don't bother using C<trailingData> 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<trailingData> by setting the
|
|
C<InputLength> option.
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 Examples
|
|
|
|
To read the contents of the file C<file1.txt.Compressed> and write the
|
|
@@ -434,7 +389,6 @@
|
|
anyinflate $input => $output
|
|
or die "anyinflate failed: $AnyInflateError\n";
|
|
|
|
-
|
|
To read from an existing Perl filehandle, C<$input>, and write the
|
|
uncompressed data to a buffer, C<$buffer>.
|
|
|
|
@@ -478,7 +432,6 @@
|
|
|
|
The format of the constructor for IO::Uncompress::AnyInflate is shown below
|
|
|
|
-
|
|
my $z = new IO::Uncompress::AnyInflate $input [OPTS]
|
|
or die "IO::Uncompress::AnyInflate failed: $AnyInflateError\n";
|
|
|
|
@@ -510,7 +463,6 @@
|
|
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
|
|
@@ -520,7 +472,6 @@
|
|
|
|
=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
|
|
|
|
@@ -544,8 +495,6 @@
|
|
|
|
=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
|
|
@@ -554,7 +503,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< Prime => $string >>
|
|
|
|
This option will uncompress the contents of C<$string> before processing the
|
|
@@ -596,8 +544,6 @@
|
|
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 >>
|
|
@@ -614,20 +560,14 @@
|
|
|
|
=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.
|
|
|
|
-
|
|
If the input is an RFC 1950 data stream, the following will be checked:
|
|
|
|
-
|
|
-
|
|
-
|
|
=over 5
|
|
|
|
=item 1
|
|
@@ -641,13 +581,8 @@
|
|
|
|
=back
|
|
|
|
-
|
|
-
|
|
If the input is a gzip (RFC 1952) data stream, the following will be checked:
|
|
|
|
-
|
|
-
|
|
-
|
|
=over 5
|
|
|
|
=item 1
|
|
@@ -686,10 +621,6 @@
|
|
|
|
=back
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< RawInflate => 0|1 >>
|
|
|
|
When auto-detecting the compressed format, try to test for raw-deflate (RFC
|
|
@@ -701,9 +632,6 @@
|
|
|
|
Defaults to 0.
|
|
|
|
-
|
|
-
|
|
-
|
|
=item C<< ParseExtra => 0|1 >>
|
|
If the gzip FEXTRA header field is present and this option is set, it will
|
|
force the module to check that it conforms to the sub-field structure as
|
|
@@ -713,9 +641,6 @@
|
|
|
|
Defaults to 0.
|
|
|
|
-
|
|
-
|
|
-
|
|
=back
|
|
|
|
=head2 Examples
|
|
@@ -759,7 +684,6 @@
|
|
Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
|
|
or a negative number on error.
|
|
|
|
-
|
|
=head2 getline
|
|
|
|
Usage is
|
|
@@ -774,7 +698,6 @@
|
|
determine what constitutes an end of line. Paragraph mode, record mode and
|
|
file slurp mode are all supported.
|
|
|
|
-
|
|
=head2 getc
|
|
|
|
Usage is
|
|
@@ -789,8 +712,6 @@
|
|
|
|
$char = $z->ungetc($string)
|
|
|
|
-
|
|
-
|
|
=head2 inflateSync
|
|
|
|
Usage is
|
|
@@ -799,7 +720,6 @@
|
|
|
|
TODO
|
|
|
|
-
|
|
=head2 getHeaderInfo
|
|
|
|
Usage is
|
|
@@ -811,9 +731,6 @@
|
|
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
|
|
@@ -830,26 +747,17 @@
|
|
$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<seek> 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.
|
|
|
|
@@ -891,8 +799,6 @@
|
|
$z->input_line_number()
|
|
$z->input_line_number(EXPR)
|
|
|
|
-
|
|
-
|
|
Returns the current uncompressed line number. If C<EXPR> 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.
|
|
@@ -900,30 +806,25 @@
|
|
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<fileno>
|
|
+will return the underlying file descriptor. Once the C<close> method is
|
|
+called C<fileno> will return C<undef>.
|
|
|
|
-If the C<$z> object is is associated with a buffer, this method will
|
|
-return undef.
|
|
+If the C<$z> object is is associated with a buffer, this method will return
|
|
+C<undef>.
|
|
|
|
=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::AnyInflate object is destroyed (either explicitly or by the
|
|
variable with the reference to the object going out of scope). The
|
|
@@ -942,9 +843,6 @@
|
|
object was created, and the object is associated with a file, the
|
|
underlying file will also be closed.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 nextStream
|
|
|
|
Usage is
|
|
@@ -983,8 +881,6 @@
|
|
|
|
Don't bother using C<trailingData> 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<trailingData> by setting the
|
|
C<InputLength> option in the constructor.
|
|
@@ -1006,8 +902,9 @@
|
|
|
|
=head1 EXAMPLES
|
|
|
|
+=head2 Working with Net::FTP
|
|
|
|
-
|
|
+See L<IO::Uncompress::AnyInflate::FAQ|IO::Uncompress::AnyInflate::FAQ/"Compressed files and Net::FTP">
|
|
|
|
=head1 SEE ALSO
|
|
|
|
@@ -1019,7 +916,6 @@
|
|
L<Archive::Tar|Archive::Tar>,
|
|
L<IO::Zlib|IO::Zlib>
|
|
|
|
-
|
|
For RFC 1950, 1951 and 1952 see
|
|
F<http://www.faqs.org/rfcs/rfc1950.html>,
|
|
F<http://www.faqs.org/rfcs/rfc1951.html> and
|
|
@@ -1033,22 +929,17 @@
|
|
|
|
The primary site for gzip is F<http://www.gzip.org>.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head1 AUTHOR
|
|
|
|
This module was written by Paul Marquess, F<pmqs@cpan.org>.
|
|
|
|
-
|
|
-
|
|
=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 -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -9,12 +9,12 @@
|
|
use warnings;
|
|
use bytes;
|
|
|
|
-use IO::Uncompress::RawInflate 2.008 ;
|
|
+use IO::Uncompress::RawInflate 2.015 ;
|
|
|
|
-use Compress::Raw::Zlib 2.008 qw( crc32 ) ;
|
|
-use IO::Compress::Base::Common 2.008 qw(:Status createSelfTiedObject);
|
|
-use IO::Compress::Gzip::Constants 2.008 ;
|
|
-use IO::Compress::Zlib::Extra 2.008 ;
|
|
+use Compress::Raw::Zlib 2.015 qw( crc32 ) ;
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
|
|
+use IO::Compress::Gzip::Constants 2.015 ;
|
|
+use IO::Compress::Zlib::Extra 2.015 ;
|
|
|
|
require Exporter ;
|
|
|
|
@@ -28,7 +28,7 @@
|
|
|
|
$GunzipError = '';
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
|
|
sub new
|
|
{
|
|
@@ -47,7 +47,7 @@
|
|
|
|
sub getExtraParams
|
|
{
|
|
- use IO::Compress::Base::Common 2.008 qw(:Parse);
|
|
+ use IO::Compress::Base::Common 2.015 qw(:Parse);
|
|
return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ;
|
|
}
|
|
|
|
@@ -278,12 +278,8 @@
|
|
|
|
=head1 NAME
|
|
|
|
-
|
|
-
|
|
IO::Uncompress::Gunzip - Read RFC 1952 files/buffers
|
|
|
|
-
|
|
-
|
|
=head1 SYNOPSIS
|
|
|
|
use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ;
|
|
@@ -329,20 +325,13 @@
|
|
eof($z)
|
|
close($z)
|
|
|
|
-
|
|
=head1 DESCRIPTION
|
|
|
|
-
|
|
-
|
|
This module provides a Perl interface that allows the reading of
|
|
files/buffers that conform to RFC 1952.
|
|
|
|
For writing RFC 1952 files/buffers, see the companion module IO::Compress::Gzip.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=head1 Functional Interface
|
|
|
|
A top-level function, C<gunzip>, is provided to carry out
|
|
@@ -355,14 +344,10 @@
|
|
gunzip $input => $output [,OPTS]
|
|
or die "gunzip failed: $GunzipError\n";
|
|
|
|
-
|
|
-
|
|
The functional interface needs Perl5.005 or better.
|
|
|
|
-
|
|
=head2 gunzip $input => $output [, OPTS]
|
|
|
|
-
|
|
C<gunzip> expects at least two parameters, C<$input> and C<$output>.
|
|
|
|
=head3 The C<$input> parameter
|
|
@@ -401,8 +386,6 @@
|
|
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 ">"
|
|
@@ -413,13 +396,10 @@
|
|
|
|
See L<File::GlobMapper|File::GlobMapper> for more details.
|
|
|
|
-
|
|
=back
|
|
|
|
If the C<$input> parameter is any other type, C<undef> will be returned.
|
|
|
|
-
|
|
-
|
|
=head3 The C<$output> parameter
|
|
|
|
The parameter C<$output> is used to control the destination of the
|
|
@@ -439,14 +419,11 @@
|
|
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
|
|
@@ -465,20 +442,13 @@
|
|
|
|
If the C<$output> parameter is any other type, C<undef> 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<gunzip>,
|
|
@@ -498,7 +468,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< BinModeOut => 0|1 >>
|
|
|
|
When writing to a file or filehandle, set C<binmode> before writing to the
|
|
@@ -506,26 +475,17 @@
|
|
|
|
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
|
|
@@ -545,19 +505,12 @@
|
|
|
|
Don't bother using C<trailingData> 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<trailingData> by setting the
|
|
C<InputLength> option.
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 Examples
|
|
|
|
To read the contents of the file C<file1.txt.gz> and write the
|
|
@@ -572,7 +525,6 @@
|
|
gunzip $input => $output
|
|
or die "gunzip failed: $GunzipError\n";
|
|
|
|
-
|
|
To read from an existing Perl filehandle, C<$input>, and write the
|
|
uncompressed data to a buffer, C<$buffer>.
|
|
|
|
@@ -616,7 +568,6 @@
|
|
|
|
The format of the constructor for IO::Uncompress::Gunzip is shown below
|
|
|
|
-
|
|
my $z = new IO::Uncompress::Gunzip $input [OPTS]
|
|
or die "IO::Uncompress::Gunzip failed: $GunzipError\n";
|
|
|
|
@@ -648,7 +599,6 @@
|
|
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
|
|
@@ -658,7 +608,6 @@
|
|
|
|
=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
|
|
|
|
@@ -682,8 +631,6 @@
|
|
|
|
=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
|
|
@@ -692,7 +639,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< Prime => $string >>
|
|
|
|
This option will uncompress the contents of C<$string> before processing the
|
|
@@ -734,8 +680,6 @@
|
|
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 >>
|
|
@@ -752,22 +696,12 @@
|
|
|
|
=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.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=over 5
|
|
|
|
=item 1
|
|
@@ -806,12 +740,6 @@
|
|
|
|
=back
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< ParseExtra => 0|1 >>
|
|
If the gzip FEXTRA header field is present and this option is set, it will
|
|
force the module to check that it conforms to the sub-field structure as
|
|
@@ -821,9 +749,6 @@
|
|
|
|
Defaults to 0.
|
|
|
|
-
|
|
-
|
|
-
|
|
=back
|
|
|
|
=head2 Examples
|
|
@@ -867,7 +792,6 @@
|
|
Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
|
|
or a negative number on error.
|
|
|
|
-
|
|
=head2 getline
|
|
|
|
Usage is
|
|
@@ -882,7 +806,6 @@
|
|
determine what constitutes an end of line. Paragraph mode, record mode and
|
|
file slurp mode are all supported.
|
|
|
|
-
|
|
=head2 getc
|
|
|
|
Usage is
|
|
@@ -897,8 +820,6 @@
|
|
|
|
$char = $z->ungetc($string)
|
|
|
|
-
|
|
-
|
|
=head2 inflateSync
|
|
|
|
Usage is
|
|
@@ -907,7 +828,6 @@
|
|
|
|
TODO
|
|
|
|
-
|
|
=head2 getHeaderInfo
|
|
|
|
Usage is
|
|
@@ -919,8 +839,6 @@
|
|
or hash references (in array context) that contains information about each
|
|
of the header fields in the compressed data stream(s).
|
|
|
|
-
|
|
-
|
|
=over 5
|
|
|
|
=item Name
|
|
@@ -937,9 +855,6 @@
|
|
|
|
=back
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 tell
|
|
|
|
Usage is
|
|
@@ -956,26 +871,17 @@
|
|
$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<seek> 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.
|
|
|
|
@@ -1017,8 +923,6 @@
|
|
$z->input_line_number()
|
|
$z->input_line_number(EXPR)
|
|
|
|
-
|
|
-
|
|
Returns the current uncompressed line number. If C<EXPR> 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.
|
|
@@ -1026,30 +930,25 @@
|
|
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<fileno>
|
|
+will return the underlying file descriptor. Once the C<close> method is
|
|
+called C<fileno> will return C<undef>.
|
|
|
|
-If the C<$z> object is is associated with a buffer, this method will
|
|
-return undef.
|
|
+If the C<$z> object is is associated with a buffer, this method will return
|
|
+C<undef>.
|
|
|
|
=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::Gunzip object is destroyed (either explicitly or by the
|
|
variable with the reference to the object going out of scope). The
|
|
@@ -1068,9 +967,6 @@
|
|
object was created, and the object is associated with a file, the
|
|
underlying file will also be closed.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 nextStream
|
|
|
|
Usage is
|
|
@@ -1109,8 +1005,6 @@
|
|
|
|
Don't bother using C<trailingData> 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<trailingData> by setting the
|
|
C<InputLength> option in the constructor.
|
|
@@ -1132,8 +1026,9 @@
|
|
|
|
=head1 EXAMPLES
|
|
|
|
+=head2 Working with Net::FTP
|
|
|
|
-
|
|
+See L<IO::Uncompress::Gunzip::FAQ|IO::Uncompress::Gunzip::FAQ/"Compressed files and Net::FTP">
|
|
|
|
=head1 SEE ALSO
|
|
|
|
@@ -1145,7 +1040,6 @@
|
|
L<Archive::Tar|Archive::Tar>,
|
|
L<IO::Zlib|IO::Zlib>
|
|
|
|
-
|
|
For RFC 1950, 1951 and 1952 see
|
|
F<http://www.faqs.org/rfcs/rfc1950.html>,
|
|
F<http://www.faqs.org/rfcs/rfc1951.html> and
|
|
@@ -1159,22 +1053,17 @@
|
|
|
|
The primary site for gzip is F<http://www.gzip.org>.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head1 AUTHOR
|
|
|
|
This module was written by Paul Marquess, F<pmqs@cpan.org>.
|
|
|
|
-
|
|
-
|
|
=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 -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -5,15 +5,15 @@
|
|
use warnings;
|
|
use bytes;
|
|
|
|
-use IO::Compress::Base::Common 2.008 qw(:Status createSelfTiedObject);
|
|
-use IO::Compress::Zlib::Constants 2.008 ;
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
|
|
+use IO::Compress::Zlib::Constants 2.015 ;
|
|
|
|
-use IO::Uncompress::RawInflate 2.008 ;
|
|
+use IO::Uncompress::RawInflate 2.015 ;
|
|
|
|
require Exporter ;
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
$InflateError = '';
|
|
|
|
@ISA = qw( Exporter IO::Uncompress::RawInflate );
|
|
@@ -199,12 +199,8 @@
|
|
|
|
=head1 NAME
|
|
|
|
-
|
|
-
|
|
IO::Uncompress::Inflate - Read RFC 1950 files/buffers
|
|
|
|
-
|
|
-
|
|
=head1 SYNOPSIS
|
|
|
|
use IO::Uncompress::Inflate qw(inflate $InflateError) ;
|
|
@@ -250,20 +246,13 @@
|
|
eof($z)
|
|
close($z)
|
|
|
|
-
|
|
=head1 DESCRIPTION
|
|
|
|
-
|
|
-
|
|
This module provides a Perl interface that allows the reading of
|
|
files/buffers that conform to RFC 1950.
|
|
|
|
For writing RFC 1950 files/buffers, see the companion module IO::Compress::Deflate.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=head1 Functional Interface
|
|
|
|
A top-level function, C<inflate>, is provided to carry out
|
|
@@ -276,14 +265,10 @@
|
|
inflate $input => $output [,OPTS]
|
|
or die "inflate failed: $InflateError\n";
|
|
|
|
-
|
|
-
|
|
The functional interface needs Perl5.005 or better.
|
|
|
|
-
|
|
=head2 inflate $input => $output [, OPTS]
|
|
|
|
-
|
|
C<inflate> expects at least two parameters, C<$input> and C<$output>.
|
|
|
|
=head3 The C<$input> parameter
|
|
@@ -322,8 +307,6 @@
|
|
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 ">"
|
|
@@ -334,13 +317,10 @@
|
|
|
|
See L<File::GlobMapper|File::GlobMapper> for more details.
|
|
|
|
-
|
|
=back
|
|
|
|
If the C<$input> parameter is any other type, C<undef> will be returned.
|
|
|
|
-
|
|
-
|
|
=head3 The C<$output> parameter
|
|
|
|
The parameter C<$output> is used to control the destination of the
|
|
@@ -360,14 +340,11 @@
|
|
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
|
|
@@ -386,20 +363,13 @@
|
|
|
|
If the C<$output> parameter is any other type, C<undef> 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<inflate>,
|
|
@@ -419,7 +389,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< BinModeOut => 0|1 >>
|
|
|
|
When writing to a file or filehandle, set C<binmode> before writing to the
|
|
@@ -427,26 +396,17 @@
|
|
|
|
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
|
|
@@ -466,19 +426,12 @@
|
|
|
|
Don't bother using C<trailingData> 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<trailingData> by setting the
|
|
C<InputLength> option.
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 Examples
|
|
|
|
To read the contents of the file C<file1.txt.1950> and write the
|
|
@@ -493,7 +446,6 @@
|
|
inflate $input => $output
|
|
or die "inflate failed: $InflateError\n";
|
|
|
|
-
|
|
To read from an existing Perl filehandle, C<$input>, and write the
|
|
uncompressed data to a buffer, C<$buffer>.
|
|
|
|
@@ -537,7 +489,6 @@
|
|
|
|
The format of the constructor for IO::Uncompress::Inflate is shown below
|
|
|
|
-
|
|
my $z = new IO::Uncompress::Inflate $input [OPTS]
|
|
or die "IO::Uncompress::Inflate failed: $InflateError\n";
|
|
|
|
@@ -569,7 +520,6 @@
|
|
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
|
|
@@ -579,7 +529,6 @@
|
|
|
|
=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
|
|
|
|
@@ -603,8 +552,6 @@
|
|
|
|
=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
|
|
@@ -613,7 +560,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< Prime => $string >>
|
|
|
|
This option will uncompress the contents of C<$string> before processing the
|
|
@@ -655,8 +601,6 @@
|
|
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 >>
|
|
@@ -673,18 +617,12 @@
|
|
|
|
=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.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=over 5
|
|
|
|
=item 1
|
|
@@ -698,17 +636,6 @@
|
|
|
|
=back
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=back
|
|
|
|
=head2 Examples
|
|
@@ -752,7 +679,6 @@
|
|
Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
|
|
or a negative number on error.
|
|
|
|
-
|
|
=head2 getline
|
|
|
|
Usage is
|
|
@@ -767,7 +693,6 @@
|
|
determine what constitutes an end of line. Paragraph mode, record mode and
|
|
file slurp mode are all supported.
|
|
|
|
-
|
|
=head2 getc
|
|
|
|
Usage is
|
|
@@ -782,8 +707,6 @@
|
|
|
|
$char = $z->ungetc($string)
|
|
|
|
-
|
|
-
|
|
=head2 inflateSync
|
|
|
|
Usage is
|
|
@@ -792,7 +715,6 @@
|
|
|
|
TODO
|
|
|
|
-
|
|
=head2 getHeaderInfo
|
|
|
|
Usage is
|
|
@@ -804,9 +726,6 @@
|
|
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
|
|
@@ -823,26 +742,17 @@
|
|
$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<seek> 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.
|
|
|
|
@@ -884,8 +794,6 @@
|
|
$z->input_line_number()
|
|
$z->input_line_number(EXPR)
|
|
|
|
-
|
|
-
|
|
Returns the current uncompressed line number. If C<EXPR> 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.
|
|
@@ -893,30 +801,25 @@
|
|
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<fileno>
|
|
+will return the underlying file descriptor. Once the C<close> method is
|
|
+called C<fileno> will return C<undef>.
|
|
|
|
-If the C<$z> object is is associated with a buffer, this method will
|
|
-return undef.
|
|
+If the C<$z> object is is associated with a buffer, this method will return
|
|
+C<undef>.
|
|
|
|
=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::Inflate object is destroyed (either explicitly or by the
|
|
variable with the reference to the object going out of scope). The
|
|
@@ -935,9 +838,6 @@
|
|
object was created, and the object is associated with a file, the
|
|
underlying file will also be closed.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 nextStream
|
|
|
|
Usage is
|
|
@@ -976,8 +876,6 @@
|
|
|
|
Don't bother using C<trailingData> 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<trailingData> by setting the
|
|
C<InputLength> option in the constructor.
|
|
@@ -999,8 +897,9 @@
|
|
|
|
=head1 EXAMPLES
|
|
|
|
+=head2 Working with Net::FTP
|
|
|
|
-
|
|
+See L<IO::Uncompress::Inflate::FAQ|IO::Uncompress::Inflate::FAQ/"Compressed files and Net::FTP">
|
|
|
|
=head1 SEE ALSO
|
|
|
|
@@ -1012,7 +911,6 @@
|
|
L<Archive::Tar|Archive::Tar>,
|
|
L<IO::Zlib|IO::Zlib>
|
|
|
|
-
|
|
For RFC 1950, 1951 and 1952 see
|
|
F<http://www.faqs.org/rfcs/rfc1950.html>,
|
|
F<http://www.faqs.org/rfcs/rfc1951.html> and
|
|
@@ -1026,22 +924,17 @@
|
|
|
|
The primary site for gzip is F<http://www.gzip.org>.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head1 AUTHOR
|
|
|
|
This module was written by Paul Marquess, F<pmqs@cpan.org>.
|
|
|
|
-
|
|
-
|
|
=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 -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -5,11 +5,11 @@
|
|
use warnings;
|
|
use bytes;
|
|
|
|
-use Compress::Raw::Zlib 2.008 ;
|
|
-use IO::Compress::Base::Common 2.008 qw(:Status createSelfTiedObject);
|
|
+use Compress::Raw::Zlib 2.015 ;
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
|
|
|
|
-use IO::Uncompress::Base 2.008 ;
|
|
-use IO::Uncompress::Adapter::Inflate 2.008 ;
|
|
+use IO::Uncompress::Base 2.015 ;
|
|
+use IO::Uncompress::Adapter::Inflate 2.015 ;
|
|
|
|
|
|
|
|
@@ -17,7 +17,7 @@
|
|
require Exporter ;
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
$RawInflateError = '';
|
|
|
|
@ISA = qw( Exporter IO::Uncompress::Base );
|
|
@@ -58,7 +58,6 @@
|
|
sub mkUncomp
|
|
{
|
|
my $self = shift ;
|
|
- my $class = shift ;
|
|
my $got = shift ;
|
|
|
|
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject(
|
|
@@ -331,12 +330,8 @@
|
|
|
|
=head1 NAME
|
|
|
|
-
|
|
-
|
|
IO::Uncompress::RawInflate - Read RFC 1951 files/buffers
|
|
|
|
-
|
|
-
|
|
=head1 SYNOPSIS
|
|
|
|
use IO::Uncompress::RawInflate qw(rawinflate $RawInflateError) ;
|
|
@@ -382,20 +377,13 @@
|
|
eof($z)
|
|
close($z)
|
|
|
|
-
|
|
=head1 DESCRIPTION
|
|
|
|
-
|
|
-
|
|
This module provides a Perl interface that allows the reading of
|
|
files/buffers that conform to RFC 1951.
|
|
|
|
For writing RFC 1951 files/buffers, see the companion module IO::Compress::RawDeflate.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=head1 Functional Interface
|
|
|
|
A top-level function, C<rawinflate>, is provided to carry out
|
|
@@ -408,14 +396,10 @@
|
|
rawinflate $input => $output [,OPTS]
|
|
or die "rawinflate failed: $RawInflateError\n";
|
|
|
|
-
|
|
-
|
|
The functional interface needs Perl5.005 or better.
|
|
|
|
-
|
|
=head2 rawinflate $input => $output [, OPTS]
|
|
|
|
-
|
|
C<rawinflate> expects at least two parameters, C<$input> and C<$output>.
|
|
|
|
=head3 The C<$input> parameter
|
|
@@ -454,8 +438,6 @@
|
|
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 ">"
|
|
@@ -466,13 +448,10 @@
|
|
|
|
See L<File::GlobMapper|File::GlobMapper> for more details.
|
|
|
|
-
|
|
=back
|
|
|
|
If the C<$input> parameter is any other type, C<undef> will be returned.
|
|
|
|
-
|
|
-
|
|
=head3 The C<$output> parameter
|
|
|
|
The parameter C<$output> is used to control the destination of the
|
|
@@ -492,14 +471,11 @@
|
|
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
|
|
@@ -518,20 +494,13 @@
|
|
|
|
If the C<$output> parameter is any other type, C<undef> 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<rawinflate>,
|
|
@@ -551,7 +520,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< BinModeOut => 0|1 >>
|
|
|
|
When writing to a file or filehandle, set C<binmode> before writing to the
|
|
@@ -559,24 +527,14 @@
|
|
|
|
Defaults to 0.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< Append => 0|1 >>
|
|
|
|
TODO
|
|
|
|
=item C<< MultiStream => 0|1 >>
|
|
|
|
-
|
|
-
|
|
This option is a no-op.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=item C<< TrailingData => $scalar >>
|
|
|
|
Returns the data, if any, that is present immediately after the compressed
|
|
@@ -596,19 +554,12 @@
|
|
|
|
Don't bother using C<trailingData> 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<trailingData> by setting the
|
|
C<InputLength> option.
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 Examples
|
|
|
|
To read the contents of the file C<file1.txt.1951> and write the
|
|
@@ -623,7 +574,6 @@
|
|
rawinflate $input => $output
|
|
or die "rawinflate failed: $RawInflateError\n";
|
|
|
|
-
|
|
To read from an existing Perl filehandle, C<$input>, and write the
|
|
uncompressed data to a buffer, C<$buffer>.
|
|
|
|
@@ -667,7 +617,6 @@
|
|
|
|
The format of the constructor for IO::Uncompress::RawInflate is shown below
|
|
|
|
-
|
|
my $z = new IO::Uncompress::RawInflate $input [OPTS]
|
|
or die "IO::Uncompress::RawInflate failed: $RawInflateError\n";
|
|
|
|
@@ -699,7 +648,6 @@
|
|
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
|
|
@@ -709,7 +657,6 @@
|
|
|
|
=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
|
|
|
|
@@ -733,8 +680,6 @@
|
|
|
|
=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
|
|
@@ -743,7 +688,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< Prime => $string >>
|
|
|
|
This option will uncompress the contents of C<$string> before processing the
|
|
@@ -785,8 +729,6 @@
|
|
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 >>
|
|
@@ -803,16 +745,8 @@
|
|
|
|
=item C<< Strict => 0|1 >>
|
|
|
|
-
|
|
-
|
|
This option is a no-op.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=back
|
|
|
|
=head2 Examples
|
|
@@ -856,7 +790,6 @@
|
|
Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
|
|
or a negative number on error.
|
|
|
|
-
|
|
=head2 getline
|
|
|
|
Usage is
|
|
@@ -871,7 +804,6 @@
|
|
determine what constitutes an end of line. Paragraph mode, record mode and
|
|
file slurp mode are all supported.
|
|
|
|
-
|
|
=head2 getc
|
|
|
|
Usage is
|
|
@@ -886,8 +818,6 @@
|
|
|
|
$char = $z->ungetc($string)
|
|
|
|
-
|
|
-
|
|
=head2 inflateSync
|
|
|
|
Usage is
|
|
@@ -896,7 +826,6 @@
|
|
|
|
TODO
|
|
|
|
-
|
|
=head2 getHeaderInfo
|
|
|
|
Usage is
|
|
@@ -908,9 +837,6 @@
|
|
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
|
|
@@ -927,26 +853,17 @@
|
|
$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<seek> 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.
|
|
|
|
@@ -988,8 +905,6 @@
|
|
$z->input_line_number()
|
|
$z->input_line_number(EXPR)
|
|
|
|
-
|
|
-
|
|
Returns the current uncompressed line number. If C<EXPR> 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.
|
|
@@ -997,30 +912,25 @@
|
|
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<fileno>
|
|
+will return the underlying file descriptor. Once the C<close> method is
|
|
+called C<fileno> will return C<undef>.
|
|
|
|
-If the C<$z> object is is associated with a buffer, this method will
|
|
-return undef.
|
|
+If the C<$z> object is is associated with a buffer, this method will return
|
|
+C<undef>.
|
|
|
|
=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::RawInflate object is destroyed (either explicitly or by the
|
|
variable with the reference to the object going out of scope). The
|
|
@@ -1039,9 +949,6 @@
|
|
object was created, and the object is associated with a file, the
|
|
underlying file will also be closed.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 nextStream
|
|
|
|
Usage is
|
|
@@ -1080,8 +987,6 @@
|
|
|
|
Don't bother using C<trailingData> 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<trailingData> by setting the
|
|
C<InputLength> option in the constructor.
|
|
@@ -1103,8 +1008,9 @@
|
|
|
|
=head1 EXAMPLES
|
|
|
|
+=head2 Working with Net::FTP
|
|
|
|
-
|
|
+See L<IO::Uncompress::RawInflate::FAQ|IO::Uncompress::RawInflate::FAQ/"Compressed files and Net::FTP">
|
|
|
|
=head1 SEE ALSO
|
|
|
|
@@ -1116,7 +1022,6 @@
|
|
L<Archive::Tar|Archive::Tar>,
|
|
L<IO::Zlib|IO::Zlib>
|
|
|
|
-
|
|
For RFC 1950, 1951 and 1952 see
|
|
F<http://www.faqs.org/rfcs/rfc1950.html>,
|
|
F<http://www.faqs.org/rfcs/rfc1951.html> and
|
|
@@ -1130,22 +1035,17 @@
|
|
|
|
The primary site for gzip is F<http://www.gzip.org>.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head1 AUTHOR
|
|
|
|
This module was written by Paul Marquess, F<pmqs@cpan.org>.
|
|
|
|
-
|
|
-
|
|
=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 -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm 2007-12-18 11:47:07.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm 2009-12-01 12:08:12.000000000 +0100
|
|
@@ -8,13 +8,14 @@
|
|
use warnings;
|
|
use bytes;
|
|
|
|
-use IO::Uncompress::RawInflate 2.008 ;
|
|
-use IO::Compress::Base::Common 2.008 qw(:Status createSelfTiedObject);
|
|
-use IO::Uncompress::Adapter::Identity 2.008 ;
|
|
-use IO::Compress::Zlib::Extra 2.008 ;
|
|
-use IO::Compress::Zip::Constants 2.008 ;
|
|
+use IO::Uncompress::RawInflate 2.015 ;
|
|
+use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
|
|
+use IO::Uncompress::Adapter::Inflate 2.015 ;
|
|
+use IO::Uncompress::Adapter::Identity 2.015 ;
|
|
+use IO::Compress::Zlib::Extra 2.015 ;
|
|
+use IO::Compress::Zip::Constants 2.015 ;
|
|
|
|
-use Compress::Raw::Zlib 2.008 qw(crc32) ;
|
|
+use Compress::Raw::Zlib 2.015 qw(crc32) ;
|
|
|
|
BEGIN
|
|
{
|
|
@@ -27,7 +28,7 @@
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
|
|
|
|
-$VERSION = '2.008';
|
|
+$VERSION = '2.015';
|
|
$UnzipError = '';
|
|
|
|
@ISA = qw(Exporter IO::Uncompress::RawInflate);
|
|
@@ -60,7 +61,7 @@
|
|
|
|
sub getExtraParams
|
|
{
|
|
- use IO::Compress::Base::Common 2.008 qw(:Parse);
|
|
+ use IO::Compress::Base::Common 2.015 qw(:Parse);
|
|
|
|
|
|
return (
|
|
@@ -84,6 +85,20 @@
|
|
return 1;
|
|
}
|
|
|
|
+sub mkUncomp
|
|
+{
|
|
+ my $self = shift ;
|
|
+ my $got = shift ;
|
|
+
|
|
+ my $magic = $self->ckMagic()
|
|
+ or return 0;
|
|
+
|
|
+ *$self->{Info} = $self->readHeader($magic)
|
|
+ or return undef ;
|
|
+
|
|
+ return 1;
|
|
+
|
|
+}
|
|
|
|
sub ckMagic
|
|
{
|
|
@@ -585,19 +600,22 @@
|
|
if ($compressedMethod == ZIP_CM_DEFLATE)
|
|
{
|
|
*$self->{Type} = 'zip-deflate';
|
|
+ my $obj = IO::Uncompress::Adapter::Inflate::mkUncompObject(1,0,0);
|
|
+
|
|
+ *$self->{Uncomp} = $obj;
|
|
+ *$self->{ZipData}{CRC32} = crc32(undef);
|
|
}
|
|
elsif ($compressedMethod == ZIP_CM_BZIP2)
|
|
{
|
|
- #if (! defined $IO::Uncompress::Adapter::Bunzip2::VERSION)
|
|
+ return $self->HeaderError("Unsupported Compression format $compressedMethod")
|
|
+ if ! defined $IO::Uncompress::Adapter::Bunzip2::VERSION ;
|
|
|
|
*$self->{Type} = 'zip-bzip2';
|
|
|
|
- my $obj = IO::Uncompress::Adapter::Bunzip2::mkUncompObject(
|
|
- );
|
|
+ my $obj = IO::Uncompress::Adapter::Bunzip2::mkUncompObject();
|
|
|
|
*$self->{Uncomp} = $obj;
|
|
*$self->{ZipData}{CRC32} = crc32(undef);
|
|
-
|
|
}
|
|
elsif ($compressedMethod == ZIP_CM_STORE)
|
|
{
|
|
@@ -605,12 +623,9 @@
|
|
|
|
*$self->{Type} = 'zip-stored';
|
|
|
|
- my $obj = IO::Uncompress::Adapter::Identity::mkUncompObject(# $got->value('CRC32'),
|
|
- # $got->value('ADLER32'),
|
|
- );
|
|
+ my $obj = IO::Uncompress::Adapter::Identity::mkUncompObject();
|
|
|
|
*$self->{Uncomp} = $obj;
|
|
-
|
|
}
|
|
else
|
|
{
|
|
@@ -705,12 +720,8 @@
|
|
|
|
=head1 NAME
|
|
|
|
-
|
|
-
|
|
IO::Uncompress::Unzip - Read zip files/buffers
|
|
|
|
-
|
|
-
|
|
=head1 SYNOPSIS
|
|
|
|
use IO::Uncompress::Unzip qw(unzip $UnzipError) ;
|
|
@@ -756,20 +767,13 @@
|
|
eof($z)
|
|
close($z)
|
|
|
|
-
|
|
=head1 DESCRIPTION
|
|
|
|
-
|
|
-
|
|
This module provides a Perl interface that allows the reading of
|
|
zlib files/buffers.
|
|
|
|
For writing zip files/buffers, see the companion module IO::Compress::Zip.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=head1 Functional Interface
|
|
|
|
A top-level function, C<unzip>, is provided to carry out
|
|
@@ -782,14 +786,10 @@
|
|
unzip $input => $output [,OPTS]
|
|
or die "unzip failed: $UnzipError\n";
|
|
|
|
-
|
|
-
|
|
The functional interface needs Perl5.005 or better.
|
|
|
|
-
|
|
=head2 unzip $input => $output [, OPTS]
|
|
|
|
-
|
|
C<unzip> expects at least two parameters, C<$input> and C<$output>.
|
|
|
|
=head3 The C<$input> parameter
|
|
@@ -828,8 +828,6 @@
|
|
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 ">"
|
|
@@ -840,13 +838,10 @@
|
|
|
|
See L<File::GlobMapper|File::GlobMapper> for more details.
|
|
|
|
-
|
|
=back
|
|
|
|
If the C<$input> parameter is any other type, C<undef> will be returned.
|
|
|
|
-
|
|
-
|
|
=head3 The C<$output> parameter
|
|
|
|
The parameter C<$output> is used to control the destination of the
|
|
@@ -866,14 +861,11 @@
|
|
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
|
|
@@ -892,20 +884,13 @@
|
|
|
|
If the C<$output> parameter is any other type, C<undef> 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<unzip>,
|
|
@@ -925,7 +910,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< BinModeOut => 0|1 >>
|
|
|
|
When writing to a file or filehandle, set C<binmode> before writing to the
|
|
@@ -933,26 +917,17 @@
|
|
|
|
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
|
|
@@ -972,19 +947,12 @@
|
|
|
|
Don't bother using C<trailingData> 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<trailingData> by setting the
|
|
C<InputLength> option.
|
|
|
|
-
|
|
-
|
|
=back
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 Examples
|
|
|
|
To read the contents of the file C<file1.txt.zip> and write the
|
|
@@ -999,7 +967,6 @@
|
|
unzip $input => $output
|
|
or die "unzip failed: $UnzipError\n";
|
|
|
|
-
|
|
To read from an existing Perl filehandle, C<$input>, and write the
|
|
uncompressed data to a buffer, C<$buffer>.
|
|
|
|
@@ -1043,7 +1010,6 @@
|
|
|
|
The format of the constructor for IO::Uncompress::Unzip is shown below
|
|
|
|
-
|
|
my $z = new IO::Uncompress::Unzip $input [OPTS]
|
|
or die "IO::Uncompress::Unzip failed: $UnzipError\n";
|
|
|
|
@@ -1075,7 +1041,6 @@
|
|
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
|
|
@@ -1085,7 +1050,6 @@
|
|
|
|
=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
|
|
|
|
@@ -1109,8 +1073,6 @@
|
|
|
|
=item C<< MultiStream => 0|1 >>
|
|
|
|
-
|
|
-
|
|
Treats the complete zip file/buffer as a single compressed data
|
|
stream. When reading in multi-stream mode each member of the zip
|
|
file/buffer will be uncompressed in turn until the end of the file/buffer
|
|
@@ -1118,7 +1080,6 @@
|
|
|
|
This parameter defaults to 0.
|
|
|
|
-
|
|
=item C<< Prime => $string >>
|
|
|
|
This option will uncompress the contents of C<$string> before processing the
|
|
@@ -1160,8 +1121,6 @@
|
|
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 >>
|
|
@@ -1178,28 +1137,12 @@
|
|
|
|
=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.
|
|
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
-
|
|
=back
|
|
|
|
=head2 Examples
|
|
@@ -1243,7 +1186,6 @@
|
|
Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
|
|
or a negative number on error.
|
|
|
|
-
|
|
=head2 getline
|
|
|
|
Usage is
|
|
@@ -1258,7 +1200,6 @@
|
|
determine what constitutes an end of line. Paragraph mode, record mode and
|
|
file slurp mode are all supported.
|
|
|
|
-
|
|
=head2 getc
|
|
|
|
Usage is
|
|
@@ -1273,8 +1214,6 @@
|
|
|
|
$char = $z->ungetc($string)
|
|
|
|
-
|
|
-
|
|
=head2 inflateSync
|
|
|
|
Usage is
|
|
@@ -1283,7 +1222,6 @@
|
|
|
|
TODO
|
|
|
|
-
|
|
=head2 getHeaderInfo
|
|
|
|
Usage is
|
|
@@ -1295,9 +1233,6 @@
|
|
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
|
|
@@ -1314,26 +1249,17 @@
|
|
$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<seek> 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.
|
|
|
|
@@ -1375,8 +1301,6 @@
|
|
$z->input_line_number()
|
|
$z->input_line_number(EXPR)
|
|
|
|
-
|
|
-
|
|
Returns the current uncompressed line number. If C<EXPR> 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.
|
|
@@ -1384,30 +1308,25 @@
|
|
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<fileno>
|
|
+will return the underlying file descriptor. Once the C<close> method is
|
|
+called C<fileno> will return C<undef>.
|
|
|
|
-If the C<$z> object is is associated with a buffer, this method will
|
|
-return undef.
|
|
+If the C<$z> object is is associated with a buffer, this method will return
|
|
+C<undef>.
|
|
|
|
=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::Unzip object is destroyed (either explicitly or by the
|
|
variable with the reference to the object going out of scope). The
|
|
@@ -1426,9 +1345,6 @@
|
|
object was created, and the object is associated with a file, the
|
|
underlying file will also be closed.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head2 nextStream
|
|
|
|
Usage is
|
|
@@ -1467,8 +1383,6 @@
|
|
|
|
Don't bother using C<trailingData> 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<trailingData> by setting the
|
|
C<InputLength> option in the constructor.
|
|
@@ -1490,8 +1404,46 @@
|
|
|
|
=head1 EXAMPLES
|
|
|
|
+=head2 Working with Net::FTP
|
|
|
|
+See L<IO::Uncompress::Unzip::FAQ|IO::Uncompress::Unzip::FAQ/"Compressed files and Net::FTP">
|
|
|
|
+=head2 Walking through a zip file
|
|
+
|
|
+The code below can be used to traverse a zip file, one compressed data
|
|
+stream at a time.
|
|
+
|
|
+ use IO::Uncompress::Unzip qw($UnzipError);
|
|
+
|
|
+ my $zipfile = "somefile.zip";
|
|
+ my $u = new IO::Uncompress::Unzip $zipfile
|
|
+ or die "Cannot open $zipfile: $UnzipError";
|
|
+
|
|
+ my $status;
|
|
+ for ($status = 1; ! $u->eof(); $status = $u->nextStream())
|
|
+ {
|
|
+
|
|
+ my $name = $u->getHeaderInfo()->{Name};
|
|
+ warn "Processing member $name\n" ;
|
|
+
|
|
+ my $buff;
|
|
+ while (($status = $u->read($buff)) > 0) {
|
|
+ # Do something here
|
|
+ }
|
|
+
|
|
+ last unless $status == 0;
|
|
+ }
|
|
+
|
|
+ die "Error processing $zipfile: $!\n"
|
|
+ if $status < 0 ;
|
|
+
|
|
+Each individual compressed data stream is read until the logical
|
|
+end-of-file is reached. Then C<nextStream> is called. This will skip to the
|
|
+start of the next compressed data stream and clear the end-of-file flag.
|
|
+
|
|
+It is also worth noting that C<nextStream> can be called at any time -- you
|
|
+don't have to wait until you have exhausted a compressed data stream before
|
|
+skipping to the next one.
|
|
|
|
=head1 SEE ALSO
|
|
|
|
@@ -1503,7 +1455,6 @@
|
|
L<Archive::Tar|Archive::Tar>,
|
|
L<IO::Zlib|IO::Zlib>
|
|
|
|
-
|
|
For RFC 1950, 1951 and 1952 see
|
|
F<http://www.faqs.org/rfcs/rfc1950.html>,
|
|
F<http://www.faqs.org/rfcs/rfc1951.html> and
|
|
@@ -1517,22 +1468,17 @@
|
|
|
|
The primary site for gzip is F<http://www.gzip.org>.
|
|
|
|
-
|
|
-
|
|
-
|
|
=head1 AUTHOR
|
|
|
|
This module was written by Paul Marquess, F<pmqs@cpan.org>.
|
|
|
|
-
|
|
-
|
|
=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 -urN perl-5.10.0.orig/ext/IO_Compress_Zlib/t/006zip.t perl-5.10.0/ext/IO_Compress_Zlib/t/006zip.t
|
|
--- perl-5.10.0.orig/ext/IO_Compress_Zlib/t/006zip.t 1970-01-01 01:00:00.000000000 +0100
|
|
+++ perl-5.10.0/ext/IO_Compress_Zlib/t/006zip.t 2008-07-12 01:15:00.000000000 +0200
|
|
@@ -0,0 +1,276 @@
|
|
+BEGIN {
|
|
+ if ($ENV{PERL_CORE}) {
|
|
+ chdir 't' if -d 't';
|
|
+ @INC = ("../lib", "lib/compress");
|
|
+ }
|
|
+}
|
|
+
|
|
+use lib qw(t t/compress);
|
|
+use strict;
|
|
+use warnings;
|
|
+use bytes;
|
|
+
|
|
+use Test::More ;
|
|
+use CompTestUtils;
|
|
+
|
|
+BEGIN {
|
|
+ # use Test::NoWarnings, if available
|
|
+ my $extra = 0 ;
|
|
+ $extra = 1
|
|
+ if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
|
|
+
|
|
+ plan tests => 77 + $extra ;
|
|
+
|
|
+ use_ok('IO::Compress::Zip', qw(:all)) ;
|
|
+ use_ok('IO::Uncompress::Unzip', qw(unzip $UnzipError)) ;
|
|
+
|
|
+ eval {
|
|
+ require IO::Compress::Bzip2 ;
|
|
+ import IO::Compress::Bzip2 2.010 ;
|
|
+ require IO::Uncompress::Bunzip2 ;
|
|
+ import IO::Uncompress::Bunzip2 2.010 ;
|
|
+ } ;
|
|
+
|
|
+}
|
|
+
|
|
+
|
|
+sub getContent
|
|
+{
|
|
+ my $filename = shift;
|
|
+
|
|
+ my $u = new IO::Uncompress::Unzip $filename, Append => 1
|
|
+ or die "Cannot open $filename: $UnzipError";
|
|
+
|
|
+ isa_ok $u, "IO::Uncompress::Unzip";
|
|
+
|
|
+ my @content;
|
|
+ my $status ;
|
|
+
|
|
+ for ($status = 1; ! $u->eof(); $status = $u->nextStream())
|
|
+ {
|
|
+
|
|
+ my $name = $u->getHeaderInfo()->{Name};
|
|
+ #warn "Processing member $name\n" ;
|
|
+
|
|
+ my $buff = '';
|
|
+ 1 while ($status = $u->read($buff)) > 0;
|
|
+
|
|
+ push @content, $buff;
|
|
+ last unless $status == 0;
|
|
+ }
|
|
+
|
|
+ die "Error processing $filename: $status $!\n"
|
|
+ if $status < 0 ;
|
|
+
|
|
+ return @content;
|
|
+}
|
|
+
|
|
+
|
|
+{
|
|
+ title "Create a simple zip - All Deflate";
|
|
+
|
|
+ my $lex = new LexFile my $file1;
|
|
+
|
|
+ my @content = (
|
|
+ 'hello',
|
|
+ '',
|
|
+ 'goodbye ',
|
|
+ );
|
|
+
|
|
+ my $zip = new IO::Compress::Zip $file1,
|
|
+ Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0;
|
|
+ isa_ok $zip, "IO::Compress::Zip";
|
|
+
|
|
+ is $zip->write($content[0]), length($content[0]), "write";
|
|
+ $zip->newStream(Name=> "two", Method => ZIP_CM_DEFLATE);
|
|
+ is $zip->write($content[1]), length($content[1]), "write";
|
|
+ $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE);
|
|
+ is $zip->write($content[2]), length($content[2]), "write";
|
|
+ ok $zip->close(), "closed";
|
|
+
|
|
+ my @got = getContent($file1);
|
|
+
|
|
+ is $got[0], $content[0], "Got 1st entry";
|
|
+ is $got[1], $content[1], "Got 2nd entry";
|
|
+ is $got[2], $content[2], "Got 3nd entry";
|
|
+}
|
|
+
|
|
+SKIP:
|
|
+{
|
|
+ title "Create a simple zip - All Bzip2";
|
|
+
|
|
+ skip "IO::Compress::Bzip2 not available", 9
|
|
+ unless defined $IO::Compress::Bzip2::VERSION;
|
|
+
|
|
+ my $lex = new LexFile my $file1;
|
|
+
|
|
+ my @content = (
|
|
+ 'hello',
|
|
+ '',
|
|
+ 'goodbye ',
|
|
+ );
|
|
+
|
|
+ my $zip = new IO::Compress::Zip $file1,
|
|
+ Name => "one", Method => ZIP_CM_BZIP2, Stream => 0;
|
|
+ isa_ok $zip, "IO::Compress::Zip";
|
|
+
|
|
+ is $zip->write($content[0]), length($content[0]), "write";
|
|
+ $zip->newStream(Name=> "two", Method => ZIP_CM_BZIP2);
|
|
+ is $zip->write($content[1]), length($content[1]), "write";
|
|
+ $zip->newStream(Name=> "three", Method => ZIP_CM_BZIP2);
|
|
+ is $zip->write($content[2]), length($content[2]), "write";
|
|
+ ok $zip->close(), "closed";
|
|
+
|
|
+ my @got = getContent($file1);
|
|
+
|
|
+ is $got[0], $content[0], "Got 1st entry";
|
|
+ is $got[1], $content[1], "Got 2nd entry";
|
|
+ is $got[2], $content[2], "Got 3nd entry";
|
|
+}
|
|
+
|
|
+SKIP:
|
|
+{
|
|
+ title "Create a simple zip - Deflate + Bzip2";
|
|
+
|
|
+ skip "IO::Compress::Bzip2 not available", 9
|
|
+ unless $IO::Compress::Bzip2::VERSION;
|
|
+
|
|
+ my $lex = new LexFile my $file1;
|
|
+
|
|
+ my @content = (
|
|
+ 'hello',
|
|
+ 'and',
|
|
+ 'goodbye ',
|
|
+ );
|
|
+
|
|
+ my $zip = new IO::Compress::Zip $file1,
|
|
+ Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0;
|
|
+ isa_ok $zip, "IO::Compress::Zip";
|
|
+
|
|
+ is $zip->write($content[0]), length($content[0]), "write";
|
|
+ $zip->newStream(Name=> "two", Method => ZIP_CM_BZIP2);
|
|
+ is $zip->write($content[1]), length($content[1]), "write";
|
|
+ $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE);
|
|
+ is $zip->write($content[2]), length($content[2]), "write";
|
|
+ ok $zip->close(), "closed";
|
|
+
|
|
+ my @got = getContent($file1);
|
|
+
|
|
+ is $got[0], $content[0], "Got 1st entry";
|
|
+ is $got[1], $content[1], "Got 2nd entry";
|
|
+ is $got[2], $content[2], "Got 3nd entry";
|
|
+}
|
|
+
|
|
+{
|
|
+ title "Create a simple zip - All STORE";
|
|
+
|
|
+ my $lex = new LexFile my $file1;
|
|
+
|
|
+ my @content = (
|
|
+ 'hello',
|
|
+ '',
|
|
+ 'goodbye ',
|
|
+ );
|
|
+
|
|
+ my $zip = new IO::Compress::Zip $file1,
|
|
+ Name => "one", Method => ZIP_CM_STORE, Stream => 0;
|
|
+ isa_ok $zip, "IO::Compress::Zip";
|
|
+
|
|
+ is $zip->write($content[0]), length($content[0]), "write";
|
|
+ $zip->newStream(Name=> "two", Method => ZIP_CM_STORE);
|
|
+ is $zip->write($content[1]), length($content[1]), "write";
|
|
+ $zip->newStream(Name=> "three", Method => ZIP_CM_STORE);
|
|
+ is $zip->write($content[2]), length($content[2]), "write";
|
|
+ ok $zip->close(), "closed";
|
|
+
|
|
+ my @got = getContent($file1);
|
|
+
|
|
+ is $got[0], $content[0], "Got 1st entry";
|
|
+ is $got[1], $content[1], "Got 2nd entry";
|
|
+ is $got[2], $content[2], "Got 3nd entry";
|
|
+}
|
|
+
|
|
+{
|
|
+ title "Create a simple zip - Deflate + STORE";
|
|
+
|
|
+ my $lex = new LexFile my $file1;
|
|
+
|
|
+ my @content = qw(
|
|
+ hello
|
|
+ and
|
|
+ goodbye
|
|
+ );
|
|
+
|
|
+ my $zip = new IO::Compress::Zip $file1,
|
|
+ Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0;
|
|
+ isa_ok $zip, "IO::Compress::Zip";
|
|
+
|
|
+ is $zip->write($content[0]), length($content[0]), "write";
|
|
+ $zip->newStream(Name=> "two", Method => ZIP_CM_STORE);
|
|
+ is $zip->write($content[1]), length($content[1]), "write";
|
|
+ $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE);
|
|
+ is $zip->write($content[2]), length($content[2]), "write";
|
|
+ ok $zip->close(), "closed";
|
|
+
|
|
+ my @got = getContent($file1);
|
|
+
|
|
+ is $got[0], $content[0], "Got 1st entry";
|
|
+ is $got[1], $content[1], "Got 2nd entry";
|
|
+ is $got[2], $content[2], "Got 3nd entry";
|
|
+}
|
|
+
|
|
+{
|
|
+ title "Create a simple zip - Deflate + zero length STORE";
|
|
+
|
|
+ my $lex = new LexFile my $file1;
|
|
+
|
|
+ my @content = (
|
|
+ 'hello ',
|
|
+ '',
|
|
+ 'goodbye ',
|
|
+ );
|
|
+
|
|
+ my $zip = new IO::Compress::Zip $file1,
|
|
+ Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0;
|
|
+ isa_ok $zip, "IO::Compress::Zip";
|
|
+
|
|
+ is $zip->write($content[0]), length($content[0]), "write";
|
|
+ $zip->newStream(Name=> "two", Method => ZIP_CM_STORE);
|
|
+ is $zip->write($content[1]), length($content[1]), "write";
|
|
+ $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE);
|
|
+ is $zip->write($content[2]), length($content[2]), "write";
|
|
+ ok $zip->close(), "closed";
|
|
+
|
|
+ my @got = getContent($file1);
|
|
+
|
|
+ is $got[0], $content[0], "Got 1st entry";
|
|
+ ok $got[1] eq $content[1], "Got 2nd entry";
|
|
+ is $got[2], $content[2], "Got 3nd entry";
|
|
+}
|
|
+
|
|
+
|
|
+SKIP:
|
|
+for my $method (ZIP_CM_DEFLATE, ZIP_CM_STORE, ZIP_CM_BZIP2)
|
|
+{
|
|
+ title "Read a line from zip, Method $method";
|
|
+
|
|
+ skip "IO::Compress::Bzip2 not available", 14
|
|
+ unless defined $IO::Compress::Bzip2::VERSION;
|
|
+
|
|
+ my $content = "a single line\n";
|
|
+ my $zip ;
|
|
+
|
|
+ my $status = zip \$content => \$zip,
|
|
+ Method => $method,
|
|
+ Stream => 0,
|
|
+ Name => "123";
|
|
+ is $status, 1, " Created a zip file";
|
|
+
|
|
+ my $u = new IO::Uncompress::Unzip \$zip;
|
|
+ isa_ok $u, "IO::Uncompress::Unzip";
|
|
+
|
|
+ is $u->getline, $content, " Read first line ok";
|
|
+ ok ! $u->getline, " Second line doesn't exist";
|
|
+
|
|
+
|
|
+}
|