summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/IO/Uncompress
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-21 00:15:27 +0000
committerKarl Berry <karl@freefriends.org>2012-05-21 00:15:27 +0000
commita4c42bfb2337d37da89d789cb8cc226367994e32 (patch)
treec3eabdef5d565a4e515d2be0d9d4d0540bde0250 /Master/tlpkg/tlperl/lib/IO/Uncompress
parent8274475057f024d35332ac47c2e2f23ea156e6ed (diff)
perl 5.14.2 from siep
git-svn-id: svn://tug.org/texlive/trunk@26525 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/IO/Uncompress')
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm30
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm46
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm47
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm10
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm26
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm20
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm22
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm114
11 files changed, 193 insertions, 140 deletions
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm
index 98677e3c09f..6703e59285a 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm
@@ -4,12 +4,12 @@ use strict;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.024 qw(:Status);
+use IO::Compress::Base::Common 2.033 qw(:Status);
-use Compress::Raw::Bzip2 2.024 ;
+use Compress::Raw::Bzip2 2.033 ;
our ($VERSION, @ISA);
-$VERSION = '2.024';
+$VERSION = '2.033';
sub mkUncompObject
{
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm
index 27de6e0f36b..0705a1c9d26 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm
@@ -4,13 +4,13 @@ use warnings;
use strict;
use bytes;
-use IO::Compress::Base::Common 2.024 qw(:Status);
+use IO::Compress::Base::Common 2.033 qw(:Status);
our ($VERSION);
-$VERSION = '2.024';
+$VERSION = '2.033';
-use Compress::Raw::Zlib 2.024 ();
+use Compress::Raw::Zlib 2.033 ();
sub mkUncompObject
{
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm
index aac1e413ffe..dc0365ce009 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm
@@ -4,11 +4,11 @@ use strict;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.024 qw(:Status);
-use Compress::Raw::Zlib 2.024 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
+use IO::Compress::Base::Common 2.033 qw(:Status);
+use Compress::Raw::Zlib 2.033 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
our ($VERSION);
-$VERSION = '2.024';
+$VERSION = '2.033';
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm
index 68038f5d374..796230ec92a 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm
@@ -6,22 +6,22 @@ use strict;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.024 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.033 qw(createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.024 ();
+use IO::Uncompress::Adapter::Inflate 2.033 ();
-use IO::Uncompress::Base 2.024 ;
-use IO::Uncompress::Gunzip 2.024 ;
-use IO::Uncompress::Inflate 2.024 ;
-use IO::Uncompress::RawInflate 2.024 ;
-use IO::Uncompress::Unzip 2.024 ;
+use IO::Uncompress::Base 2.033 ;
+use IO::Uncompress::Gunzip 2.033 ;
+use IO::Uncompress::Inflate 2.033 ;
+use IO::Uncompress::RawInflate 2.033 ;
+use IO::Uncompress::Unzip 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError);
-$VERSION = '2.024';
+$VERSION = '2.033';
$AnyInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
@@ -48,7 +48,7 @@ sub anyinflate
sub getExtraParams
{
- use IO::Compress::Base::Common 2.024 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
@@ -256,8 +256,6 @@ If C<$input> is a string that is delimited by the characters "<" and ">"
C<anyinflate> will assume that it is an I<input fileglob string>. The
input is the list of files that match the fileglob.
-If the fileglob does not match any files ...
-
See L<File::GlobMapper|File::GlobMapper> for more details.
=back
@@ -302,6 +300,8 @@ output is the list of files that match the fileglob.
When C<$output> is an fileglob string, C<$input> must also be a fileglob
string. Anything else is an error.
+See L<File::GlobMapper|File::GlobMapper> for more details.
+
=back
If the C<$output> parameter is any other type, C<undef> will be returned.
@@ -371,8 +371,8 @@ data to the output data stream.
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
@@ -562,7 +562,7 @@ the module will allow reading of it anyway.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
@@ -980,7 +980,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm
index 5984921e25b..64d2fa001a8 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm
@@ -4,16 +4,16 @@ use strict;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.024 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.033 qw(createSelfTiedObject);
-use IO::Uncompress::Base 2.024 ;
+use IO::Uncompress::Base 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError);
-$VERSION = '2.024';
+$VERSION = '2.033';
$AnyUncompressError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
@@ -27,22 +27,22 @@ Exporter::export_ok_tags('all');
BEGIN
{
- eval ' use IO::Uncompress::Adapter::Inflate 2.024 ;';
- eval ' use IO::Uncompress::Adapter::Bunzip2 2.024 ;';
- eval ' use IO::Uncompress::Adapter::LZO 2.024 ;';
- eval ' use IO::Uncompress::Adapter::Lzf 2.024 ;';
+ eval ' use IO::Uncompress::Adapter::Inflate 2.033 ;';
+ eval ' use IO::Uncompress::Adapter::Bunzip2 2.033 ;';
+ eval ' use IO::Uncompress::Adapter::LZO 2.033 ;';
+ eval ' use IO::Uncompress::Adapter::Lzf 2.033 ;';
eval ' use IO::Uncompress::Adapter::UnLzma 2.020 ;';
eval ' use IO::Uncompress::Adapter::UnXz 2.020 ;';
- eval ' use IO::Uncompress::Bunzip2 2.024 ;';
- eval ' use IO::Uncompress::UnLzop 2.024 ;';
- eval ' use IO::Uncompress::Gunzip 2.024 ;';
- eval ' use IO::Uncompress::Inflate 2.024 ;';
- eval ' use IO::Uncompress::RawInflate 2.024 ;';
- eval ' use IO::Uncompress::Unzip 2.024 ;';
- eval ' use IO::Uncompress::UnLzf 2.024 ;';
- eval ' use IO::Uncompress::UnLzma 2.024 ;';
- eval ' use IO::Uncompress::UnXz 2.024 ;';
+ eval ' use IO::Uncompress::Bunzip2 2.033 ;';
+ eval ' use IO::Uncompress::UnLzop 2.033 ;';
+ eval ' use IO::Uncompress::Gunzip 2.033 ;';
+ eval ' use IO::Uncompress::Inflate 2.033 ;';
+ eval ' use IO::Uncompress::RawInflate 2.033 ;';
+ eval ' use IO::Uncompress::Unzip 2.033 ;';
+ eval ' use IO::Uncompress::UnLzf 2.033 ;';
+ eval ' use IO::Uncompress::UnLzma 2.033 ;';
+ eval ' use IO::Uncompress::UnXz 2.033 ;';
}
sub new
@@ -60,7 +60,7 @@ sub anyuncompress
sub getExtraParams
{
- use IO::Compress::Base::Common 2.024 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ,
'UnLzma' => [1, 1, Parse_boolean, 0] ) ;
}
@@ -365,8 +365,6 @@ If C<$input> is a string that is delimited by the characters "<" and ">"
C<anyuncompress> will assume that it is an I<input fileglob string>. The
input is the list of files that match the fileglob.
-If the fileglob does not match any files ...
-
See L<File::GlobMapper|File::GlobMapper> for more details.
=back
@@ -411,6 +409,8 @@ output is the list of files that match the fileglob.
When C<$output> is an fileglob string, C<$input> must also be a fileglob
string. Anything else is an error.
+See L<File::GlobMapper|File::GlobMapper> for more details.
+
=back
If the C<$output> parameter is any other type, C<undef> will be returned.
@@ -480,8 +480,8 @@ data to the output data stream.
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
@@ -671,7 +671,7 @@ the module will allow reading of it anyway.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
@@ -1011,7 +1011,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm
index 33f2ac23758..77e4a8c5810 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm
@@ -9,12 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS);
@ISA = qw(Exporter IO::File);
-$VERSION = '2.024';
+$VERSION = '2.033';
use constant G_EOF => 0 ;
use constant G_ERR => -1 ;
-use IO::Compress::Base::Common 2.024 ;
+use IO::Compress::Base::Common 2.033 ;
#use Parse::Parameters ;
use IO::File ;
@@ -34,9 +34,11 @@ sub smartRead
my $self = $_[0];
my $out = $_[1];
my $size = $_[2];
+ #$$out = "" ;
$$out = "" ;
my $offset = 0 ;
+ my $status = 1;
if (defined *$self->{InputLength}) {
@@ -69,11 +71,12 @@ sub smartRead
# because the filehandle may not support the offset parameter
# An example is Net::FTP
my $tmp = '';
- *$self->{FH}->read($tmp, $get_size) &&
- (substr($$out, $offset) = $tmp);
+ $status = *$self->{FH}->read($tmp, $get_size) ;
+ substr($$out, $offset) = $tmp
+ if defined $status && $status > 0 ;
}
else
- { *$self->{FH}->read($$out, $get_size) }
+ { $status = *$self->{FH}->read($$out, $get_size) }
}
elsif (defined *$self->{InputEvent}) {
my $got = 1 ;
@@ -105,6 +108,11 @@ sub smartRead
*$self->{InputLengthRemaining} -= length($$out) #- $offset
if defined *$self->{InputLength};
+ if (! defined $status) {
+ $self->saveStatus($!) ;
+ return STATUS_ERROR;
+ }
+
$self->saveStatus(length $$out < 0 ? STATUS_ERROR : STATUS_OK) ;
return length $$out;
@@ -776,8 +784,8 @@ sub readBlock
}
my $status = $self->smartRead($buff, $size) ;
- return $self->saveErrorString(STATUS_ERROR, "Error Reading Data")
- if $status < 0 ;
+ return $self->saveErrorString(STATUS_ERROR, "Error Reading Data: $!")
+ if $status == STATUS_ERROR ;
if ($status == 0 ) {
*$self->{Closed} = 1 ;
@@ -814,7 +822,7 @@ sub _raw_read
my $len = $self->smartRead(\$tmp_buff, *$self->{BlockSize}) ;
return $self->saveErrorString(G_ERR, "Error reading data: $!", $!)
- if $len < 0 ;
+ if $len == STATUS_ERROR ;
if ($len == 0 ) {
*$self->{EndStream} = 1 ;
@@ -980,7 +988,7 @@ sub gotoNextStream
#*$self->{EndStream} = 0 ;
if ( ! defined $magic) {
- if (! *$self->{Transparent} )
+ if (! *$self->{Transparent} || $self->eof())
{
*$self->{EndStream} = 1 ;
return 0;
@@ -1123,33 +1131,34 @@ sub read
sub _getline
{
my $self = shift ;
+ my $status = 0 ;
# Slurp Mode
if ( ! defined $/ ) {
my $data ;
- 1 while $self->read($data) > 0 ;
- return \$data ;
+ 1 while ($status = $self->read($data)) > 0 ;
+ return $status < 0 ? \undef : \$data ;
}
# Record Mode
if ( ref $/ eq 'SCALAR' && ${$/} =~ /^\d+$/ && ${$/} > 0) {
my $reclen = ${$/} ;
my $data ;
- $self->read($data, $reclen) ;
- return \$data ;
+ $status = $self->read($data, $reclen) ;
+ return $status < 0 ? \undef : \$data ;
}
# Paragraph Mode
if ( ! length $/ ) {
my $paragraph ;
- while ($self->read($paragraph) > 0 ) {
+ while (($status = $self->read($paragraph)) > 0 ) {
if ($paragraph =~ s/^(.*?\n\n+)//s) {
*$self->{Pending} = $paragraph ;
my $par = $1 ;
return \$par ;
}
}
- return \$paragraph;
+ return $status < 0 ? \undef : \$paragraph;
}
# $/ isn't empty, or a reference, so it's Line Mode.
@@ -1165,7 +1174,7 @@ sub _getline
return \$l;
}
- while ($self->read($line) > 0 ) {
+ while (($status = $self->read($line)) > 0 ) {
my $offset = index($line, $/);
if ($offset >= 0) {
my $l = substr($line, 0, $offset + length $/ );
@@ -1175,7 +1184,7 @@ sub _getline
}
}
- return \$line;
+ return $status < 0 ? \undef : \$line;
}
}
@@ -1445,7 +1454,7 @@ IO::Uncompress::Base - Base Class for IO::Uncompress modules
=head1 DESCRIPTION
This module is not intended for direct use in application code. Its sole
-purpose if to to be sub-classed by IO::Unompress modules.
+purpose if to to be sub-classed by IO::Uncompress modules.
=head1 SEE ALSO
@@ -1467,7 +1476,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm
index b3988c41851..39adbef079b 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm
@@ -4,15 +4,15 @@ use strict ;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject);
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Base 2.024 ;
-use IO::Uncompress::Adapter::Bunzip2 2.024 ;
+use IO::Uncompress::Base 2.033 ;
+use IO::Uncompress::Adapter::Bunzip2 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error);
-$VERSION = '2.024';
+$VERSION = '2.033';
$Bunzip2Error = '';
@ISA = qw( Exporter IO::Uncompress::Base );
@@ -40,7 +40,7 @@ sub getExtraParams
{
my $self = shift ;
- use IO::Compress::Base::Common 2.024 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return (
'Verbosity' => [1, 1, Parse_boolean, 0],
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm
index f3e4e6561f0..94fd6756d9e 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm
@@ -9,12 +9,12 @@ use strict ;
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.024 ;
+use IO::Uncompress::RawInflate 2.033 ;
-use Compress::Raw::Zlib 2.024 qw( crc32 ) ;
-use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.024 ;
-use IO::Compress::Zlib::Extra 2.024 ;
+use Compress::Raw::Zlib 2.033 qw( crc32 ) ;
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.033 ;
+use IO::Compress::Zlib::Extra 2.033 ;
require Exporter ;
@@ -28,7 +28,7 @@ Exporter::export_ok_tags('all');
$GunzipError = '';
-$VERSION = '2.024';
+$VERSION = '2.033';
sub new
{
@@ -47,7 +47,7 @@ sub gunzip
sub getExtraParams
{
- use IO::Compress::Base::Common 2.024 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ;
}
@@ -392,8 +392,6 @@ If C<$input> is a string that is delimited by the characters "<" and ">"
C<gunzip> will assume that it is an I<input fileglob string>. The
input is the list of files that match the fileglob.
-If the fileglob does not match any files ...
-
See L<File::GlobMapper|File::GlobMapper> for more details.
=back
@@ -438,6 +436,8 @@ output is the list of files that match the fileglob.
When C<$output> is an fileglob string, C<$input> must also be a fileglob
string. Anything else is an error.
+See L<File::GlobMapper|File::GlobMapper> for more details.
+
=back
If the C<$output> parameter is any other type, C<undef> will be returned.
@@ -507,8 +507,8 @@ data to the output data stream.
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
@@ -698,7 +698,7 @@ the module will allow reading of it anyway.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
@@ -1104,7 +1104,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm
index 956f62e0835..a7b12fcde4f 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm
@@ -5,15 +5,15 @@ use strict ;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject);
-use IO::Compress::Zlib::Constants 2.024 ;
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
+use IO::Compress::Zlib::Constants 2.033 ;
-use IO::Uncompress::RawInflate 2.024 ;
+use IO::Uncompress::RawInflate 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
-$VERSION = '2.024';
+$VERSION = '2.033';
$InflateError = '';
@ISA = qw( Exporter IO::Uncompress::RawInflate );
@@ -313,8 +313,6 @@ If C<$input> is a string that is delimited by the characters "<" and ">"
C<inflate> will assume that it is an I<input fileglob string>. The
input is the list of files that match the fileglob.
-If the fileglob does not match any files ...
-
See L<File::GlobMapper|File::GlobMapper> for more details.
=back
@@ -359,6 +357,8 @@ output is the list of files that match the fileglob.
When C<$output> is an fileglob string, C<$input> must also be a fileglob
string. Anything else is an error.
+See L<File::GlobMapper|File::GlobMapper> for more details.
+
=back
If the C<$output> parameter is any other type, C<undef> will be returned.
@@ -428,8 +428,8 @@ data to the output data stream.
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
@@ -619,7 +619,7 @@ the module will allow reading of it anyway.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
@@ -975,7 +975,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm
index f017fa0f599..07d70e316c7 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm
@@ -5,16 +5,16 @@ use strict ;
use warnings;
use bytes;
-use Compress::Raw::Zlib 2.024 ;
-use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject);
+use Compress::Raw::Zlib 2.033 ;
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Base 2.024 ;
-use IO::Uncompress::Adapter::Inflate 2.024 ;
+use IO::Uncompress::Base 2.033 ;
+use IO::Uncompress::Adapter::Inflate 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
-$VERSION = '2.024';
+$VERSION = '2.033';
$RawInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
@@ -461,8 +461,6 @@ If C<$input> is a string that is delimited by the characters "<" and ">"
C<rawinflate> will assume that it is an I<input fileglob string>. The
input is the list of files that match the fileglob.
-If the fileglob does not match any files ...
-
See L<File::GlobMapper|File::GlobMapper> for more details.
=back
@@ -507,6 +505,8 @@ output is the list of files that match the fileglob.
When C<$output> is an fileglob string, C<$input> must also be a fileglob
string. Anything else is an error.
+See L<File::GlobMapper|File::GlobMapper> for more details.
+
=back
If the C<$output> parameter is any other type, C<undef> will be returned.
@@ -576,8 +576,8 @@ data to the output data stream.
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
@@ -764,7 +764,7 @@ the module will allow reading of it anyway.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
@@ -1103,7 +1103,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm
index e7d6849f66b..a678251a899 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm
@@ -8,14 +8,14 @@ use strict ;
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.024 ;
-use IO::Compress::Base::Common 2.024 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.024 ;
-use IO::Uncompress::Adapter::Identity 2.024 ;
-use IO::Compress::Zlib::Extra 2.024 ;
-use IO::Compress::Zip::Constants 2.024 ;
+use IO::Uncompress::RawInflate 2.033 ;
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
+use IO::Uncompress::Adapter::Inflate 2.033 ;
+use IO::Uncompress::Adapter::Identity 2.033 ;
+use IO::Compress::Zlib::Extra 2.033 ;
+use IO::Compress::Zip::Constants 2.033 ;
-use Compress::Raw::Zlib 2.024 qw(crc32) ;
+use Compress::Raw::Zlib 2.033 qw(crc32) ;
BEGIN
{
@@ -30,7 +30,7 @@ require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
-$VERSION = '2.024';
+$VERSION = '2.033';
$UnzipError = '';
@ISA = qw(Exporter IO::Uncompress::RawInflate);
@@ -63,7 +63,7 @@ sub unzip
sub getExtraParams
{
- use IO::Compress::Base::Common 2.024 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return (
@@ -894,8 +894,6 @@ If C<$input> is a string that is delimited by the characters "<" and ">"
C<unzip> will assume that it is an I<input fileglob string>. The
input is the list of files that match the fileglob.
-If the fileglob does not match any files ...
-
See L<File::GlobMapper|File::GlobMapper> for more details.
=back
@@ -940,6 +938,8 @@ output is the list of files that match the fileglob.
When C<$output> is an fileglob string, C<$input> must also be a fileglob
string. Anything else is an error.
+See L<File::GlobMapper|File::GlobMapper> for more details.
+
=back
If the C<$output> parameter is any other type, C<undef> will be returned.
@@ -1009,8 +1009,8 @@ data to the output data stream.
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
@@ -1056,54 +1056,57 @@ C<InputLength> option.
=head2 Examples
-To read the contents of the file C<file1.txt.zip> and write the
-uncompressed data to the file C<file1.txt>.
+Say you have a zip file, C<file1.zip>, that only contains a
+single member, you can read it and write the uncompressed data to the
+file C<file1.txt> like this.
use strict ;
use warnings ;
use IO::Uncompress::Unzip qw(unzip $UnzipError) ;
- my $input = "file1.txt.zip";
+ my $input = "file1.zip";
my $output = "file1.txt";
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>.
+If you have a zip file that contains multiple members and want to read a
+specific member from the file, say C<"data1">, use the C<Name> option
use strict ;
use warnings ;
use IO::Uncompress::Unzip qw(unzip $UnzipError) ;
- use IO::File ;
- my $input = new IO::File "<file1.txt.zip"
- or die "Cannot open 'file1.txt.zip': $!\n" ;
- my $buffer ;
- unzip $input => \$buffer
+ my $input = "file1.zip";
+ my $output = "file1.txt";
+ unzip $input => $output, Name => "data1"
or die "unzip failed: $UnzipError\n";
-To uncompress all files in the directory "/my/home" that match "*.txt.zip" and store the compressed data in the same directory
+Alternatively, if you want to read the C<"data1"> member into memory, use
+a scalar reference for the C<output> partameter.
use strict ;
use warnings ;
use IO::Uncompress::Unzip qw(unzip $UnzipError) ;
- unzip '</my/home/*.txt.zip>' => '</my/home/#1.txt>'
+ my $input = "file1.zip";
+ my $output ;
+ unzip $input => \$output, Name => "data1"
or die "unzip failed: $UnzipError\n";
+ # $output now contains the uncompressed data
-and if you want to compress each file one at a time, this will do the trick
+To read from an existing Perl filehandle, C<$input>, and write the
+uncompressed data to a buffer, C<$buffer>.
use strict ;
use warnings ;
use IO::Uncompress::Unzip qw(unzip $UnzipError) ;
+ use IO::File ;
- for my $input ( glob "/my/home/*.txt.zip" )
- {
- my $output = $input;
- $output =~ s/.zip// ;
- unzip $input => $output
- or die "Error compressing '$input': $UnzipError\n";
- }
+ my $input = new IO::File "<file1.zip"
+ or die "Cannot open 'file1.zip': $!\n" ;
+ my $buffer ;
+ unzip $input => \$buffer
+ or die "unzip failed: $UnzipError\n";
=head1 OO Interface
@@ -1163,6 +1166,10 @@ OPTS is a combination of the following options:
=over 5
+=item C<< Name => "membername" >>
+
+Open "membername" from the zip file for reading.
+
=item C<< AutoClose => 0|1 >>
This option is only valid when the C<$input> parameter is a filehandle. If
@@ -1199,7 +1206,7 @@ the module will allow reading of it anyway.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
@@ -1509,6 +1516,43 @@ Same as doing this
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 if $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
L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
@@ -1542,7 +1586,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 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.