diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/IO/Uncompress')
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm | 6 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm | 6 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm | 8 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm | 131 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm | 158 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm | 158 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm | 24 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm | 122 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm | 115 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm | 127 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm | 145 |
11 files changed, 555 insertions, 445 deletions
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm index 516c5dda4f0..c35601cd3d2 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.048 qw(:Status); +use IO::Compress::Base::Common 2.060 qw(:Status); -use Compress::Raw::Bzip2 2.048 ; +use Compress::Raw::Bzip2 2.060 ; our ($VERSION, @ISA); -$VERSION = '2.048'; +$VERSION = '2.060'; 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 5d74d042124..5c63b5ccbd2 100644 --- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm +++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm @@ -4,14 +4,14 @@ use warnings; use strict; use bytes; -use IO::Compress::Base::Common 2.048 qw(:Status); +use IO::Compress::Base::Common 2.060 qw(:Status); use IO::Compress::Zip::Constants ; our ($VERSION); -$VERSION = '2.048'; +$VERSION = '2.060'; -use Compress::Raw::Zlib 2.048 (); +use Compress::Raw::Zlib 2.060 (); 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 c0f3542a98a..5d8e1a326d3 100644 --- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm +++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm @@ -2,13 +2,13 @@ package IO::Uncompress::Adapter::Inflate; use strict; use warnings; -use bytes; +#use bytes; -use IO::Compress::Base::Common 2.048 qw(:Status); -use Compress::Raw::Zlib 2.048 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); +use IO::Compress::Base::Common 2.060 qw(:Status); +use Compress::Raw::Zlib 2.060 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); our ($VERSION); -$VERSION = '2.048'; +$VERSION = '2.060'; diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm index a6ab437159a..14c695f0d44 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.048 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.060 (); -use IO::Uncompress::Adapter::Inflate 2.048 (); +use IO::Uncompress::Adapter::Inflate 2.060 (); -use IO::Uncompress::Base 2.048 ; -use IO::Uncompress::Gunzip 2.048 ; -use IO::Uncompress::Inflate 2.048 ; -use IO::Uncompress::RawInflate 2.048 ; -use IO::Uncompress::Unzip 2.048 ; +use IO::Uncompress::Base 2.060 ; +use IO::Uncompress::Gunzip 2.060 ; +use IO::Uncompress::Inflate 2.060 ; +use IO::Uncompress::RawInflate 2.060 ; +use IO::Uncompress::Unzip 2.060 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError); -$VERSION = '2.048'; +$VERSION = '2.060'; $AnyInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -36,20 +36,20 @@ Exporter::export_ok_tags('all'); sub new { my $class = shift ; - my $obj = createSelfTiedObject($class, \$AnyInflateError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$AnyInflateError); $obj->_create(undef, 0, @_); } sub anyinflate { - my $obj = createSelfTiedObject(undef, \$AnyInflateError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$AnyInflateError); return $obj->_inf(@_) ; } sub getExtraParams { - use IO::Compress::Base::Common 2.048 qw(:Parse); - return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ; + use IO::Compress::Base::Common 2.060 qw(:Parse); + return ( 'rawinflate' => [Parse_boolean, 0] ) ; } sub ckParams @@ -58,8 +58,8 @@ sub ckParams my $got = shift ; # any always needs both crc32 and adler32 - $got->value('CRC32' => 1); - $got->value('ADLER32' => 1); + $got->setValue('crc32' => 1); + $got->setValue('adler32' => 1); return 1; } @@ -78,7 +78,7 @@ sub mkUncomp my @possible = qw( Inflate Gunzip Unzip ); unshift @possible, 'RawInflate' - if 1 || $got->value('RawInflate'); + if 1 || $got->getValue('rawinflate'); my $magic = $self->ckMagic( @possible ); @@ -205,19 +205,20 @@ section. use IO::Uncompress::AnyInflate qw(anyinflate $AnyInflateError) ; - anyinflate $input => $output [,OPTS] + anyinflate $input_filename_or_reference => $output_filename_or_reference [,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>. +C<anyinflate> expects at least two parameters, +C<$input_filename_or_reference> and C<$output_filename_or_reference>. -=head3 The C<$input> parameter +=head3 The C<$input_filename_or_reference> parameter -The parameter, C<$input>, is used to define the source of -the compressed data. +The parameter, C<$input_filename_or_reference>, is used to define the +source of the compressed data. It can take one of the following forms: @@ -225,25 +226,25 @@ It can take one of the following forms: =item A filename -If the C<$input> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for reading and the input data -will be read from it. +If the <$input_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for reading and the +input data will be read from it. =item A filehandle -If the C<$input> parameter is a filehandle, the input data will be -read from it. -The string '-' can be used as an alias for standard input. +If the C<$input_filename_or_reference> parameter is a filehandle, the input +data will be read from it. The string '-' can be used as an alias for +standard input. =item A scalar reference -If C<$input> is a scalar reference, the input data will be read -from C<$$input>. +If C<$input_filename_or_reference> is a scalar reference, the input data +will be read from C<$$input_filename_or_reference>. =item An array reference -If C<$input> is an array reference, each element in the array must be a -filename. +If C<$input_filename_or_reference> is an array reference, each element in +the array must be a filename. The input data will be read from each file in turn. @@ -252,64 +253,71 @@ 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 ">" -C<anyinflate> will assume that it is an I<input fileglob string>. The -input is the list of files that match the fileglob. +If C<$input_filename_or_reference> 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. See L<File::GlobMapper|File::GlobMapper> for more details. =back -If the C<$input> parameter is any other type, C<undef> will be returned. +If the C<$input_filename_or_reference> parameter is any other type, +C<undef> will be returned. -=head3 The C<$output> parameter +=head3 The C<$output_filename_or_reference> parameter -The parameter C<$output> is used to control the destination of the -uncompressed data. This parameter can take one of these forms. +The parameter C<$output_filename_or_reference> is used to control the +destination of the uncompressed data. This parameter can take one of +these forms. =over 5 =item A filename -If the C<$output> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for writing and the uncompressed -data will be written to it. +If the C<$output_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for writing and the +uncompressed data will be written to it. =item A filehandle -If the C<$output> parameter is a filehandle, the uncompressed data -will be written to it. -The string '-' can be used as an alias for standard output. +If the C<$output_filename_or_reference> parameter is a filehandle, the +uncompressed data will be written to it. The string '-' can be used as +an alias for standard output. =item A scalar reference -If C<$output> is a scalar reference, the uncompressed data will be -stored in C<$$output>. +If C<$output_filename_or_reference> is a scalar reference, the +uncompressed data will be stored in C<$$output_filename_or_reference>. =item An Array Reference -If C<$output> is an array reference, the uncompressed data will be -pushed onto the array. +If C<$output_filename_or_reference> is an array reference, +the uncompressed data will be pushed onto the array. =item An Output FileGlob -If C<$output> is a string that is delimited by the characters "<" and ">" -C<anyinflate> will assume that it is an I<output fileglob string>. The -output is the list of files that match the fileglob. +If C<$output_filename_or_reference> is a string that is delimited by the +characters "<" and ">" C<anyinflate> will assume that it is an +I<output fileglob string>. The 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. +When C<$output_filename_or_reference> is an fileglob string, +C<$input_filename_or_reference> 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. +If the C<$output_filename_or_reference> 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 +When C<$input_filename_or_reference> maps to multiple compressed +files/buffers and C<$output_filename_or_reference> is +a single file/buffer, after uncompression C<$output_filename_or_reference> will contain a concatenation of all the uncompressed data from each of the input files/buffers. @@ -507,7 +515,7 @@ 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 -C<$$output>. +C<$$input>. =back @@ -799,6 +807,13 @@ 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. +Note that the implementation of C<seek> in this module does not provide +true random access to a compressed file/buffer. It works by uncompressing +data from the current offset in the file/buffer until it reaches the +ucompressed offset specified in the parameters to C<seek>. For very small +files this may be acceptable behaviour. For large files it may cause an +unacceptable delay. + The C<$whence> parameter takes one the usual values, namely SEEK_SET, SEEK_CUR or SEEK_END. @@ -945,7 +960,7 @@ Same as doing this =head2 Working with Net::FTP -See L<IO::Uncompress::AnyInflate::FAQ|IO::Uncompress::AnyInflate::FAQ/"Compressed files and Net::FTP"> +See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> =head1 SEE ALSO @@ -980,7 +995,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2012 Paul Marquess. All rights reserved. +Copyright (c) 2005-2013 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 d9a48e6a240..a202763c0a5 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.048 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.060 (); -use IO::Uncompress::Base 2.048 ; +use IO::Uncompress::Base 2.060 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError); -$VERSION = '2.048'; +$VERSION = '2.060'; $AnyUncompressError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -27,42 +27,41 @@ Exporter::export_ok_tags('all'); BEGIN { - eval ' use IO::Uncompress::Adapter::Inflate 2.048 ;'; - eval ' use IO::Uncompress::Adapter::Bunzip2 2.048 ;'; - eval ' use IO::Uncompress::Adapter::LZO 2.048 ;'; - eval ' use IO::Uncompress::Adapter::Lzf 2.048 ;'; - eval ' use IO::Uncompress::Adapter::UnLzma 2.048 ;'; - eval ' use IO::Uncompress::Adapter::UnXz 2.048 ;'; - - eval ' use IO::Uncompress::Bunzip2 2.048 ;'; - eval ' use IO::Uncompress::UnLzop 2.048 ;'; - eval ' use IO::Uncompress::Gunzip 2.048 ;'; - eval ' use IO::Uncompress::Inflate 2.048 ;'; - eval ' use IO::Uncompress::RawInflate 2.048 ;'; - eval ' use IO::Uncompress::Unzip 2.048 ;'; - eval ' use IO::Uncompress::UnLzf 2.048 ;'; - eval ' use IO::Uncompress::UnLzma 2.048 ;'; - eval ' use IO::Uncompress::UnXz 2.048 ;'; + eval ' use IO::Uncompress::Adapter::Inflate 2.060 ;'; + eval ' use IO::Uncompress::Adapter::Bunzip2 2.060 ;'; + eval ' use IO::Uncompress::Adapter::LZO 2.060 ;'; + eval ' use IO::Uncompress::Adapter::Lzf 2.060 ;'; + eval ' use IO::Uncompress::Adapter::UnLzma 2.060 ;'; + eval ' use IO::Uncompress::Adapter::UnXz 2.060 ;'; + + eval ' use IO::Uncompress::Bunzip2 2.060 ;'; + eval ' use IO::Uncompress::UnLzop 2.060 ;'; + eval ' use IO::Uncompress::Gunzip 2.060 ;'; + eval ' use IO::Uncompress::Inflate 2.060 ;'; + eval ' use IO::Uncompress::RawInflate 2.060 ;'; + eval ' use IO::Uncompress::Unzip 2.060 ;'; + eval ' use IO::Uncompress::UnLzf 2.060 ;'; + eval ' use IO::Uncompress::UnLzma 2.060 ;'; + eval ' use IO::Uncompress::UnXz 2.060 ;'; } sub new { my $class = shift ; - my $obj = createSelfTiedObject($class, \$AnyUncompressError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$AnyUncompressError); $obj->_create(undef, 0, @_); } sub anyuncompress { - my $obj = createSelfTiedObject(undef, \$AnyUncompressError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$AnyUncompressError); return $obj->_inf(@_) ; } sub getExtraParams -{ - use IO::Compress::Base::Common 2.048 qw(:Parse); - return ( 'RawInflate' => [1, 1, Parse_boolean, 0] , - 'UnLzma' => [1, 1, Parse_boolean, 0] ) ; +{ + return ( 'rawinflate' => [IO::Compress::Base::Common::Parse_boolean, 0] , + 'unlzma' => [IO::Compress::Base::Common::Parse_boolean, 0] ) ; } sub ckParams @@ -71,8 +70,8 @@ sub ckParams my $got = shift ; # any always needs both crc32 and adler32 - $got->value('CRC32' => 1); - $got->value('ADLER32' => 1); + $got->setValue('crc32' => 1); + $got->setValue('adler32' => 1); return 1; } @@ -96,7 +95,7 @@ sub mkUncomp my @possible = qw( Inflate Gunzip Unzip ); unshift @possible, 'RawInflate' - if $got->value('RawInflate'); + if $got->getValue('rawinflate'); $magic = $self->ckMagic( @possible ); @@ -108,7 +107,7 @@ sub mkUncomp } } - if (defined $IO::Uncompress::UnLzma::VERSION && $got->value('UnLzma')) + if (defined $IO::Uncompress::UnLzma::VERSION && $got->getValue('unlzma')) { my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnLzma::mkUncompObject(); @@ -119,7 +118,7 @@ sub mkUncomp my @possible = qw( UnLzma ); #unshift @possible, 'RawInflate' - # if $got->value('RawInflate'); + # if $got->getValue('rawinflate'); if ( *$self->{Info} = $self->ckMagic( @possible )) { @@ -314,19 +313,20 @@ section. use IO::Uncompress::AnyUncompress qw(anyuncompress $AnyUncompressError) ; - anyuncompress $input => $output [,OPTS] + anyuncompress $input_filename_or_reference => $output_filename_or_reference [,OPTS] or die "anyuncompress failed: $AnyUncompressError\n"; The functional interface needs Perl5.005 or better. =head2 anyuncompress $input => $output [, OPTS] -C<anyuncompress> expects at least two parameters, C<$input> and C<$output>. +C<anyuncompress> expects at least two parameters, +C<$input_filename_or_reference> and C<$output_filename_or_reference>. -=head3 The C<$input> parameter +=head3 The C<$input_filename_or_reference> parameter -The parameter, C<$input>, is used to define the source of -the compressed data. +The parameter, C<$input_filename_or_reference>, is used to define the +source of the compressed data. It can take one of the following forms: @@ -334,25 +334,25 @@ It can take one of the following forms: =item A filename -If the C<$input> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for reading and the input data -will be read from it. +If the <$input_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for reading and the +input data will be read from it. =item A filehandle -If the C<$input> parameter is a filehandle, the input data will be -read from it. -The string '-' can be used as an alias for standard input. +If the C<$input_filename_or_reference> parameter is a filehandle, the input +data will be read from it. The string '-' can be used as an alias for +standard input. =item A scalar reference -If C<$input> is a scalar reference, the input data will be read -from C<$$input>. +If C<$input_filename_or_reference> is a scalar reference, the input data +will be read from C<$$input_filename_or_reference>. =item An array reference -If C<$input> is an array reference, each element in the array must be a -filename. +If C<$input_filename_or_reference> is an array reference, each element in +the array must be a filename. The input data will be read from each file in turn. @@ -361,64 +361,71 @@ 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 ">" -C<anyuncompress> will assume that it is an I<input fileglob string>. The -input is the list of files that match the fileglob. +If C<$input_filename_or_reference> 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. See L<File::GlobMapper|File::GlobMapper> for more details. =back -If the C<$input> parameter is any other type, C<undef> will be returned. +If the C<$input_filename_or_reference> parameter is any other type, +C<undef> will be returned. -=head3 The C<$output> parameter +=head3 The C<$output_filename_or_reference> parameter -The parameter C<$output> is used to control the destination of the -uncompressed data. This parameter can take one of these forms. +The parameter C<$output_filename_or_reference> is used to control the +destination of the uncompressed data. This parameter can take one of +these forms. =over 5 =item A filename -If the C<$output> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for writing and the uncompressed -data will be written to it. +If the C<$output_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for writing and the +uncompressed data will be written to it. =item A filehandle -If the C<$output> parameter is a filehandle, the uncompressed data -will be written to it. -The string '-' can be used as an alias for standard output. +If the C<$output_filename_or_reference> parameter is a filehandle, the +uncompressed data will be written to it. The string '-' can be used as +an alias for standard output. =item A scalar reference -If C<$output> is a scalar reference, the uncompressed data will be -stored in C<$$output>. +If C<$output_filename_or_reference> is a scalar reference, the +uncompressed data will be stored in C<$$output_filename_or_reference>. =item An Array Reference -If C<$output> is an array reference, the uncompressed data will be -pushed onto the array. +If C<$output_filename_or_reference> is an array reference, +the uncompressed data will be pushed onto the array. =item An Output FileGlob -If C<$output> is a string that is delimited by the characters "<" and ">" -C<anyuncompress> will assume that it is an I<output fileglob string>. The -output is the list of files that match the fileglob. +If C<$output_filename_or_reference> is a string that is delimited by the +characters "<" and ">" C<anyuncompress> will assume that it is an +I<output fileglob string>. The 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. +When C<$output_filename_or_reference> is an fileglob string, +C<$input_filename_or_reference> 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. +If the C<$output_filename_or_reference> 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 +When C<$input_filename_or_reference> maps to multiple compressed +files/buffers and C<$output_filename_or_reference> is +a single file/buffer, after uncompression C<$output_filename_or_reference> will contain a concatenation of all the uncompressed data from each of the input files/buffers. @@ -616,7 +623,7 @@ 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 -C<$$output>. +C<$$input>. =back @@ -847,6 +854,13 @@ 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. +Note that the implementation of C<seek> in this module does not provide +true random access to a compressed file/buffer. It works by uncompressing +data from the current offset in the file/buffer until it reaches the +ucompressed offset specified in the parameters to C<seek>. For very small +files this may be acceptable behaviour. For large files it may cause an +unacceptable delay. + The C<$whence> parameter takes one the usual values, namely SEEK_SET, SEEK_CUR or SEEK_END. @@ -1011,7 +1025,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2012 Paul Marquess. All rights reserved. +Copyright (c) 2005-2013 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 cb1e15e9aef..5d6336b9473 100644 --- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm +++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm @@ -3,23 +3,23 @@ package IO::Uncompress::Base ; use strict ; use warnings; -use bytes; +#use bytes; our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter IO::File); -$VERSION = '2.048'; +$VERSION = '2.060'; use constant G_EOF => 0 ; use constant G_ERR => -1 ; -use IO::Compress::Base::Common 2.048 ; +use IO::Compress::Base::Common 2.060 ; use IO::File ; use Symbol; -use Scalar::Util qw(readonly); -use List::Util qw(min); +use Scalar::Util (); +use List::Util (); use Carp ; %EXPORT_TAGS = ( ); @@ -39,7 +39,7 @@ sub smartRead if (defined *$self->{InputLength}) { return 0 if *$self->{InputLengthRemaining} <= 0 ; - $size = min($size, *$self->{InputLengthRemaining}); + $size = List::Util::min($size, *$self->{InputLengthRemaining}); } if ( length *$self->{Prime} ) { @@ -348,34 +348,34 @@ sub checkParams my $got = shift || IO::Compress::Base::Parameters::new(); my $Valid = { - 'BlockSize' => [1, 1, Parse_unsigned, 16 * 1024], - 'AutoClose' => [1, 1, Parse_boolean, 0], - 'Strict' => [1, 1, Parse_boolean, 0], - 'Append' => [1, 1, Parse_boolean, 0], - 'Prime' => [1, 1, Parse_any, undef], - 'MultiStream' => [1, 1, Parse_boolean, 0], - 'Transparent' => [1, 1, Parse_any, 1], - 'Scan' => [1, 1, Parse_boolean, 0], - 'InputLength' => [1, 1, Parse_unsigned, undef], - 'BinModeOut' => [1, 1, Parse_boolean, 0], - #'Encode' => [1, 1, Parse_any, undef], - - #'ConsumeInput' => [1, 1, Parse_boolean, 0], - + 'blocksize' => [IO::Compress::Base::Common::Parse_unsigned, 16 * 1024], + 'autoclose' => [IO::Compress::Base::Common::Parse_boolean, 0], + 'strict' => [IO::Compress::Base::Common::Parse_boolean, 0], + 'append' => [IO::Compress::Base::Common::Parse_boolean, 0], + 'prime' => [IO::Compress::Base::Common::Parse_any, undef], + 'multistream' => [IO::Compress::Base::Common::Parse_boolean, 0], + 'transparent' => [IO::Compress::Base::Common::Parse_any, 1], + 'scan' => [IO::Compress::Base::Common::Parse_boolean, 0], + 'inputlength' => [IO::Compress::Base::Common::Parse_unsigned, undef], + 'binmodeout' => [IO::Compress::Base::Common::Parse_boolean, 0], + #'decode' => [IO::Compress::Base::Common::Parse_any, undef], + + #'consumeinput' => [IO::Compress::Base::Common::Parse_boolean, 0], + $self->getExtraParams(), #'Todo - Revert to ordinary file on end Z_STREAM_END'=> 0, # ContinueAfterEof } ; - $Valid->{TrailingData} = [1, 1, Parse_writable_scalar, undef] + $Valid->{trailingdata} = [IO::Compress::Base::Common::Parse_writable_scalar, undef] if *$self->{OneShot} ; $got->parse($Valid, @_ ) - or $self->croakError("${class}: $got->{Error}") ; + or $self->croakError("${class}: " . $got->getError()) ; $self->postCheckParams($got) - or $self->croakError("${class}: " . $self->error()) ; + or $self->croakError("${class}: " . $self->error()) ; return $got; } @@ -392,7 +392,7 @@ sub _create my $inValue = shift ; - *$obj->{OneShot} = 0 ; + *$obj->{OneShot} = 0 ; if (! $got) { @@ -422,12 +422,12 @@ sub _create # Need to rewind for Scan *$obj->{FH}->seek(0, SEEK_SET) - if $got->value('Scan'); + if $got->getValue('scan'); } else { no warnings ; my $mode = '<'; - $mode = '+<' if $got->value('Scan'); + $mode = '+<' if $got->getValue('scan'); *$obj->{StdIO} = ($inValue eq '-'); *$obj->{FH} = new IO::File "$mode $inValue" or return $obj->saveErrorString(undef, "cannot open file '$inValue': $!", $!) ; @@ -440,32 +440,34 @@ sub _create *$obj->{Buffer} = \$buff ; } - if ($got->parsed('Encode')) { - my $want_encoding = $got->value('Encode'); - *$obj->{Encoding} = getEncoding($obj, $class, $want_encoding); - } - +# if ($got->getValue('decode')) { +# my $want_encoding = $got->getValue('decode'); +# *$obj->{Encoding} = IO::Compress::Base::Common::getEncoding($obj, $class, $want_encoding); +# } +# else { +# *$obj->{Encoding} = undef; +# } - *$obj->{InputLength} = $got->parsed('InputLength') - ? $got->value('InputLength') + *$obj->{InputLength} = $got->parsed('inputlength') + ? $got->getValue('inputlength') : undef ; - *$obj->{InputLengthRemaining} = $got->value('InputLength'); + *$obj->{InputLengthRemaining} = $got->getValue('inputlength'); *$obj->{BufferOffset} = 0 ; - *$obj->{AutoClose} = $got->value('AutoClose'); - *$obj->{Strict} = $got->value('Strict'); - *$obj->{BlockSize} = $got->value('BlockSize'); - *$obj->{Append} = $got->value('Append'); - *$obj->{AppendOutput} = $append_mode || $got->value('Append'); - *$obj->{ConsumeInput} = $got->value('ConsumeInput'); - *$obj->{Transparent} = $got->value('Transparent'); - *$obj->{MultiStream} = $got->value('MultiStream'); + *$obj->{AutoClose} = $got->getValue('autoclose'); + *$obj->{Strict} = $got->getValue('strict'); + *$obj->{BlockSize} = $got->getValue('blocksize'); + *$obj->{Append} = $got->getValue('append'); + *$obj->{AppendOutput} = $append_mode || $got->getValue('append'); + *$obj->{ConsumeInput} = $got->getValue('consumeinput'); + *$obj->{Transparent} = $got->getValue('transparent'); + *$obj->{MultiStream} = $got->getValue('multistream'); # TODO - move these two into RawDeflate - *$obj->{Scan} = $got->value('Scan'); - *$obj->{ParseExtra} = $got->value('ParseExtra') - || $got->value('Strict') ; + *$obj->{Scan} = $got->getValue('scan'); + *$obj->{ParseExtra} = $got->getValue('parseextra') + || $got->getValue('strict') ; *$obj->{Type} = ''; - *$obj->{Prime} = $got->value('Prime') || '' ; + *$obj->{Prime} = $got->getValue('prime') || '' ; *$obj->{Pending} = ''; *$obj->{Plain} = 0; *$obj->{PlainBytesRead} = 0; @@ -577,13 +579,36 @@ sub _inf my $got = $obj->checkParams($name, undef, @_) or return undef ; - if ($got->parsed('TrailingData')) + if ($got->parsed('trailingdata')) { - *$obj->{TrailingData} = $got->value('TrailingData'); +# my $value = $got->valueRef('TrailingData'); +# warn "TD $value "; +# #$value = $$value; +## warn "TD $value $$value "; +# +# return retErr($obj, "Parameter 'TrailingData' not writable") +# if readonly $$value ; +# +# if (ref $$value) +# { +# return retErr($obj,"Parameter 'TrailingData' not a scalar reference") +# if ref $$value ne 'SCALAR' ; +# +# *$obj->{TrailingData} = $$value ; +# } +# else +# { +# return retErr($obj,"Parameter 'TrailingData' not a scalar") +# if ref $value ne 'SCALAR' ; +# +# *$obj->{TrailingData} = $value ; +# } + + *$obj->{TrailingData} = $got->getValue('trailingdata'); } - *$obj->{MultiStream} = $got->value('MultiStream'); - $got->value('MultiStream', 0); + *$obj->{MultiStream} = $got->getValue('multistream'); + $got->setValue('multistream', 0); $x->{Got} = $got ; @@ -663,17 +688,17 @@ sub _singleTarget if ($x->{outType} eq 'filename') { my $mode = '>' ; $mode = '>>' - if $x->{Got}->value('Append') ; + if $x->{Got}->getValue('append') ; $x->{fh} = new IO::File "$mode $output" or return retErr($x, "cannot open file '$output': $!") ; - binmode $x->{fh} if $x->{Got}->valueOrDefault('BinModeOut'); + binmode $x->{fh} if $x->{Got}->valueOrDefault('binmodeout'); } elsif ($x->{outType} eq 'handle') { $x->{fh} = $output; - binmode $x->{fh} if $x->{Got}->valueOrDefault('BinModeOut'); - if ($x->{Got}->value('Append')) { + binmode $x->{fh} if $x->{Got}->valueOrDefault('binmodeout'); + if ($x->{Got}->getValue('append')) { seek($x->{fh}, 0, SEEK_END) or return retErr($x, "Cannot seek to end of output filehandle: $!") ; } @@ -683,7 +708,7 @@ sub _singleTarget elsif ($x->{outType} eq 'buffer' ) { $$output = '' - unless $x->{Got}->value('Append'); + unless $x->{Got}->getValue('append'); $x->{buff} = $output ; } @@ -703,7 +728,7 @@ sub _singleTarget if ( ($x->{outType} eq 'filename' && $output ne '-') || - ($x->{outType} eq 'handle' && $x->{Got}->value('AutoClose'))) { + ($x->{outType} eq 'handle' && $x->{Got}->getValue('autoclose'))) { $x->{fh}->close() or return retErr($x, $!); delete $x->{fh}; @@ -719,7 +744,7 @@ sub _rd2 my $input = shift; my $output = shift; - my $z = createSelfTiedObject($x->{Class}, *$self->{Error}); + my $z = IO::Compress::Base::Common::createSelfTiedObject($x->{Class}, *$self->{Error}); $z->_create($x->{Got}, 1, $input, @_) or return undef ; @@ -803,7 +828,7 @@ sub readBlock *$self->{CompressedInputLengthDone} = 1; return STATUS_OK ; } - $size = min($size, *$self->{CompressedInputLengthRemaining} ); + $size = List::Util::min($size, *$self->{CompressedInputLengthRemaining} ); *$self->{CompressedInputLengthRemaining} -= $size ; } @@ -905,9 +930,12 @@ sub _raw_read $self->filterUncompressed($buffer, $before_len); - if (*$self->{Encoding}) { - $$buffer = *$self->{Encoding}->decode($$buffer); - } +# if (*$self->{Encoding}) { +# use Encode ; +# *$self->{PendingDecode} .= substr($$buffer, $before_len) ; +# my $got = *$self->{Encoding}->decode(*$self->{PendingDecode}, Encode::FB_QUIET) ; +# substr($$buffer, $before_len) = $got; +# } } if ($status == STATUS_ENDSTREAM) { @@ -1073,7 +1101,7 @@ sub read if (ref $_[0] ) { $self->croakError(*$self->{ClassName} . "::read: buffer parameter is read-only") - if readonly(${ $_[0] }); + if Scalar::Util::readonly(${ $_[0] }); $self->croakError(*$self->{ClassName} . "::read: not a scalar reference $_[0]" ) unless ref $_[0] eq 'SCALAR' ; @@ -1081,7 +1109,7 @@ sub read } else { $self->croakError(*$self->{ClassName} . "::read: buffer parameter is read-only") - if readonly($_[0]); + if Scalar::Util::readonly($_[0]); $buffer = \$_[0] ; } @@ -1402,7 +1430,7 @@ sub seek my $offset = $target - $here ; my $got; - while (($got = $self->read(my $buffer, min($offset, *$self->{BlockSize})) ) > 0) + while (($got = $self->read(my $buffer, List::Util::min($offset, *$self->{BlockSize})) ) > 0) { $offset -= $got; last if $offset == 0 ; @@ -1520,7 +1548,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2012 Paul Marquess. All rights reserved. +Copyright (c) 2005-2013 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 f53513a7e48..ccfb69b2bd8 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.048 qw(:Status createSelfTiedObject); +use IO::Compress::Base::Common 2.060 qw(:Status ); -use IO::Uncompress::Base 2.048 ; -use IO::Uncompress::Adapter::Bunzip2 2.048 ; +use IO::Uncompress::Base 2.060 ; +use IO::Uncompress::Adapter::Bunzip2 2.060 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error); -$VERSION = '2.048'; +$VERSION = '2.060'; $Bunzip2Error = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -25,26 +25,22 @@ push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; sub new { my $class = shift ; - my $obj = createSelfTiedObject($class, \$Bunzip2Error); + my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$Bunzip2Error); $obj->_create(undef, 0, @_); } sub bunzip2 { - my $obj = createSelfTiedObject(undef, \$Bunzip2Error); + my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$Bunzip2Error); return $obj->_inf(@_); } sub getExtraParams { - my $self = shift ; - - use IO::Compress::Base::Common 2.048 qw(:Parse); - return ( - 'Verbosity' => [1, 1, Parse_boolean, 0], - 'Small' => [1, 1, Parse_boolean, 0], + 'verbosity' => [IO::Compress::Base::Common::Parse_boolean, 0], + 'small' => [IO::Compress::Base::Common::Parse_boolean, 0], ); } @@ -68,8 +64,8 @@ sub mkUncomp *$self->{Info} = $self->readHeader($magic) or return undef ; - my $Small = $got->value('Small'); - my $Verbosity = $got->value('Verbosity'); + my $Small = $got->getValue('small'); + my $Verbosity = $got->getValue('verbosity'); my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Bunzip2::mkUncompObject( $Small, $Verbosity); diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm index bf803ae161b..753d34a5bc9 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.048 ; +use IO::Uncompress::RawInflate 2.060 ; -use Compress::Raw::Zlib 2.048 () ; -use IO::Compress::Base::Common 2.048 qw(:Status createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.048 ; -use IO::Compress::Zlib::Extra 2.048 ; +use Compress::Raw::Zlib 2.060 () ; +use IO::Compress::Base::Common 2.060 qw(:Status ); +use IO::Compress::Gzip::Constants 2.060 ; +use IO::Compress::Zlib::Extra 2.060 ; require Exporter ; @@ -28,27 +28,26 @@ Exporter::export_ok_tags('all'); $GunzipError = ''; -$VERSION = '2.048'; +$VERSION = '2.060'; sub new { my $class = shift ; $GunzipError = ''; - my $obj = createSelfTiedObject($class, \$GunzipError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$GunzipError); $obj->_create(undef, 0, @_); } sub gunzip { - my $obj = createSelfTiedObject(undef, \$GunzipError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$GunzipError); return $obj->_inf(@_) ; } sub getExtraParams { - use IO::Compress::Base::Common 2.048 qw(:Parse); - return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ; + return ( 'parseextra' => [IO::Compress::Base::Common::Parse_boolean, 0] ) ; } sub ckParams @@ -57,7 +56,7 @@ sub ckParams my $got = shift ; # gunzip always needs crc32 - $got->value('CRC32' => 1); + $got->setValue('crc32' => 1); return 1; } @@ -341,19 +340,20 @@ section. use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ; - gunzip $input => $output [,OPTS] + gunzip $input_filename_or_reference => $output_filename_or_reference [,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>. +C<gunzip> expects at least two parameters, +C<$input_filename_or_reference> and C<$output_filename_or_reference>. -=head3 The C<$input> parameter +=head3 The C<$input_filename_or_reference> parameter -The parameter, C<$input>, is used to define the source of -the compressed data. +The parameter, C<$input_filename_or_reference>, is used to define the +source of the compressed data. It can take one of the following forms: @@ -361,25 +361,25 @@ It can take one of the following forms: =item A filename -If the C<$input> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for reading and the input data -will be read from it. +If the <$input_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for reading and the +input data will be read from it. =item A filehandle -If the C<$input> parameter is a filehandle, the input data will be -read from it. -The string '-' can be used as an alias for standard input. +If the C<$input_filename_or_reference> parameter is a filehandle, the input +data will be read from it. The string '-' can be used as an alias for +standard input. =item A scalar reference -If C<$input> is a scalar reference, the input data will be read -from C<$$input>. +If C<$input_filename_or_reference> is a scalar reference, the input data +will be read from C<$$input_filename_or_reference>. =item An array reference -If C<$input> is an array reference, each element in the array must be a -filename. +If C<$input_filename_or_reference> is an array reference, each element in +the array must be a filename. The input data will be read from each file in turn. @@ -388,64 +388,71 @@ 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 ">" -C<gunzip> will assume that it is an I<input fileglob string>. The -input is the list of files that match the fileglob. +If C<$input_filename_or_reference> 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. See L<File::GlobMapper|File::GlobMapper> for more details. =back -If the C<$input> parameter is any other type, C<undef> will be returned. +If the C<$input_filename_or_reference> parameter is any other type, +C<undef> will be returned. -=head3 The C<$output> parameter +=head3 The C<$output_filename_or_reference> parameter -The parameter C<$output> is used to control the destination of the -uncompressed data. This parameter can take one of these forms. +The parameter C<$output_filename_or_reference> is used to control the +destination of the uncompressed data. This parameter can take one of +these forms. =over 5 =item A filename -If the C<$output> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for writing and the uncompressed -data will be written to it. +If the C<$output_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for writing and the +uncompressed data will be written to it. =item A filehandle -If the C<$output> parameter is a filehandle, the uncompressed data -will be written to it. -The string '-' can be used as an alias for standard output. +If the C<$output_filename_or_reference> parameter is a filehandle, the +uncompressed data will be written to it. The string '-' can be used as +an alias for standard output. =item A scalar reference -If C<$output> is a scalar reference, the uncompressed data will be -stored in C<$$output>. +If C<$output_filename_or_reference> is a scalar reference, the +uncompressed data will be stored in C<$$output_filename_or_reference>. =item An Array Reference -If C<$output> is an array reference, the uncompressed data will be -pushed onto the array. +If C<$output_filename_or_reference> is an array reference, +the uncompressed data will be pushed onto the array. =item An Output FileGlob -If C<$output> is a string that is delimited by the characters "<" and ">" -C<gunzip> will assume that it is an I<output fileglob string>. The -output is the list of files that match the fileglob. +If C<$output_filename_or_reference> is a string that is delimited by the +characters "<" and ">" C<gunzip> will assume that it is an +I<output fileglob string>. The 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. +When C<$output_filename_or_reference> is an fileglob string, +C<$input_filename_or_reference> 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. +If the C<$output_filename_or_reference> 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 +When C<$input_filename_or_reference> maps to multiple compressed +files/buffers and C<$output_filename_or_reference> is +a single file/buffer, after uncompression C<$output_filename_or_reference> will contain a concatenation of all the uncompressed data from each of the input files/buffers. @@ -643,7 +650,7 @@ 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 -C<$$output>. +C<$$input>. =back @@ -923,6 +930,13 @@ 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. +Note that the implementation of C<seek> in this module does not provide +true random access to a compressed file/buffer. It works by uncompressing +data from the current offset in the file/buffer until it reaches the +ucompressed offset specified in the parameters to C<seek>. For very small +files this may be acceptable behaviour. For large files it may cause an +unacceptable delay. + The C<$whence> parameter takes one the usual values, namely SEEK_SET, SEEK_CUR or SEEK_END. @@ -1069,7 +1083,7 @@ Same as doing this =head2 Working with Net::FTP -See L<IO::Uncompress::Gunzip::FAQ|IO::Uncompress::Gunzip::FAQ/"Compressed files and Net::FTP"> +See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> =head1 SEE ALSO @@ -1104,7 +1118,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2012 Paul Marquess. All rights reserved. +Copyright (c) 2005-2013 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 7a40889fa84..4cea9aa0028 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.048 qw(:Status createSelfTiedObject); -use IO::Compress::Zlib::Constants 2.048 ; +use IO::Compress::Base::Common 2.060 qw(:Status ); +use IO::Compress::Zlib::Constants 2.060 ; -use IO::Uncompress::RawInflate 2.048 ; +use IO::Uncompress::RawInflate 2.060 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError); -$VERSION = '2.048'; +$VERSION = '2.060'; $InflateError = ''; @ISA = qw( Exporter IO::Uncompress::RawInflate ); @@ -26,14 +26,14 @@ Exporter::export_ok_tags('all'); sub new { my $class = shift ; - my $obj = createSelfTiedObject($class, \$InflateError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$InflateError); $obj->_create(undef, 0, @_); } sub inflate { - my $obj = createSelfTiedObject(undef, \$InflateError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$InflateError); return $obj->_inf(@_); } @@ -48,7 +48,7 @@ sub ckParams my $got = shift ; # gunzip always needs adler32 - $got->value('ADLER32' => 1); + $got->setValue('adler32' => 1); return 1; } @@ -262,19 +262,20 @@ section. use IO::Uncompress::Inflate qw(inflate $InflateError) ; - inflate $input => $output [,OPTS] + inflate $input_filename_or_reference => $output_filename_or_reference [,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>. +C<inflate> expects at least two parameters, +C<$input_filename_or_reference> and C<$output_filename_or_reference>. -=head3 The C<$input> parameter +=head3 The C<$input_filename_or_reference> parameter -The parameter, C<$input>, is used to define the source of -the compressed data. +The parameter, C<$input_filename_or_reference>, is used to define the +source of the compressed data. It can take one of the following forms: @@ -282,25 +283,25 @@ It can take one of the following forms: =item A filename -If the C<$input> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for reading and the input data -will be read from it. +If the <$input_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for reading and the +input data will be read from it. =item A filehandle -If the C<$input> parameter is a filehandle, the input data will be -read from it. -The string '-' can be used as an alias for standard input. +If the C<$input_filename_or_reference> parameter is a filehandle, the input +data will be read from it. The string '-' can be used as an alias for +standard input. =item A scalar reference -If C<$input> is a scalar reference, the input data will be read -from C<$$input>. +If C<$input_filename_or_reference> is a scalar reference, the input data +will be read from C<$$input_filename_or_reference>. =item An array reference -If C<$input> is an array reference, each element in the array must be a -filename. +If C<$input_filename_or_reference> is an array reference, each element in +the array must be a filename. The input data will be read from each file in turn. @@ -309,64 +310,71 @@ 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 ">" -C<inflate> will assume that it is an I<input fileglob string>. The -input is the list of files that match the fileglob. +If C<$input_filename_or_reference> 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. See L<File::GlobMapper|File::GlobMapper> for more details. =back -If the C<$input> parameter is any other type, C<undef> will be returned. +If the C<$input_filename_or_reference> parameter is any other type, +C<undef> will be returned. -=head3 The C<$output> parameter +=head3 The C<$output_filename_or_reference> parameter -The parameter C<$output> is used to control the destination of the -uncompressed data. This parameter can take one of these forms. +The parameter C<$output_filename_or_reference> is used to control the +destination of the uncompressed data. This parameter can take one of +these forms. =over 5 =item A filename -If the C<$output> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for writing and the uncompressed -data will be written to it. +If the C<$output_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for writing and the +uncompressed data will be written to it. =item A filehandle -If the C<$output> parameter is a filehandle, the uncompressed data -will be written to it. -The string '-' can be used as an alias for standard output. +If the C<$output_filename_or_reference> parameter is a filehandle, the +uncompressed data will be written to it. The string '-' can be used as +an alias for standard output. =item A scalar reference -If C<$output> is a scalar reference, the uncompressed data will be -stored in C<$$output>. +If C<$output_filename_or_reference> is a scalar reference, the +uncompressed data will be stored in C<$$output_filename_or_reference>. =item An Array Reference -If C<$output> is an array reference, the uncompressed data will be -pushed onto the array. +If C<$output_filename_or_reference> is an array reference, +the uncompressed data will be pushed onto the array. =item An Output FileGlob -If C<$output> is a string that is delimited by the characters "<" and ">" -C<inflate> will assume that it is an I<output fileglob string>. The -output is the list of files that match the fileglob. +If C<$output_filename_or_reference> is a string that is delimited by the +characters "<" and ">" C<inflate> will assume that it is an +I<output fileglob string>. The 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. +When C<$output_filename_or_reference> is an fileglob string, +C<$input_filename_or_reference> 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. +If the C<$output_filename_or_reference> 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 +When C<$input_filename_or_reference> maps to multiple compressed +files/buffers and C<$output_filename_or_reference> is +a single file/buffer, after uncompression C<$output_filename_or_reference> will contain a concatenation of all the uncompressed data from each of the input files/buffers. @@ -564,7 +572,7 @@ 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 -C<$$output>. +C<$$input>. =back @@ -794,6 +802,13 @@ 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. +Note that the implementation of C<seek> in this module does not provide +true random access to a compressed file/buffer. It works by uncompressing +data from the current offset in the file/buffer until it reaches the +ucompressed offset specified in the parameters to C<seek>. For very small +files this may be acceptable behaviour. For large files it may cause an +unacceptable delay. + The C<$whence> parameter takes one the usual values, namely SEEK_SET, SEEK_CUR or SEEK_END. @@ -940,7 +955,7 @@ Same as doing this =head2 Working with Net::FTP -See L<IO::Uncompress::Inflate::FAQ|IO::Uncompress::Inflate::FAQ/"Compressed files and Net::FTP"> +See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> =head1 SEE ALSO @@ -975,7 +990,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2012 Paul Marquess. All rights reserved. +Copyright (c) 2005-2013 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 0372ec72e35..9a57eb343c6 100644 --- a/Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm +++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm @@ -3,18 +3,18 @@ package IO::Uncompress::RawInflate ; use strict ; use warnings; -use bytes; +#use bytes; -use Compress::Raw::Zlib 2.048 ; -use IO::Compress::Base::Common 2.048 qw(:Status createSelfTiedObject); +use Compress::Raw::Zlib 2.060 ; +use IO::Compress::Base::Common 2.060 qw(:Status ); -use IO::Uncompress::Base 2.048 ; -use IO::Uncompress::Adapter::Inflate 2.048 ; +use IO::Uncompress::Base 2.060 ; +use IO::Uncompress::Adapter::Inflate 2.060 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError); -$VERSION = '2.048'; +$VERSION = '2.060'; $RawInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -45,13 +45,13 @@ Exporter::export_ok_tags('all'); sub new { my $class = shift ; - my $obj = createSelfTiedObject($class, \$RawInflateError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$RawInflateError); $obj->_create(undef, 0, @_); } sub rawinflate { - my $obj = createSelfTiedObject(undef, \$RawInflateError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$RawInflateError); return $obj->_inf(@_); } @@ -74,9 +74,9 @@ sub mkUncomp my $got = shift ; my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject( - $got->value('CRC32'), - $got->value('ADLER32'), - $got->value('Scan'), + $got->getValue('crc32'), + $got->getValue('adler32'), + $got->getValue('scan'), ); return $self->saveErrorString(undef, $errstr, $errno) @@ -332,8 +332,8 @@ sub createDeflate my ($def, $status) = *$self->{Uncomp}->createDeflateStream( -AppendOutput => 1, -WindowBits => - MAX_WBITS, - -CRC32 => *$self->{Params}->value('CRC32'), - -ADLER32 => *$self->{Params}->value('ADLER32'), + -CRC32 => *$self->{Params}->getValue('crc32'), + -ADLER32 => *$self->{Params}->getValue('adler32'), ); return wantarray ? ($status, $def) : $def ; @@ -410,19 +410,20 @@ section. use IO::Uncompress::RawInflate qw(rawinflate $RawInflateError) ; - rawinflate $input => $output [,OPTS] + rawinflate $input_filename_or_reference => $output_filename_or_reference [,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>. +C<rawinflate> expects at least two parameters, +C<$input_filename_or_reference> and C<$output_filename_or_reference>. -=head3 The C<$input> parameter +=head3 The C<$input_filename_or_reference> parameter -The parameter, C<$input>, is used to define the source of -the compressed data. +The parameter, C<$input_filename_or_reference>, is used to define the +source of the compressed data. It can take one of the following forms: @@ -430,25 +431,25 @@ It can take one of the following forms: =item A filename -If the C<$input> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for reading and the input data -will be read from it. +If the <$input_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for reading and the +input data will be read from it. =item A filehandle -If the C<$input> parameter is a filehandle, the input data will be -read from it. -The string '-' can be used as an alias for standard input. +If the C<$input_filename_or_reference> parameter is a filehandle, the input +data will be read from it. The string '-' can be used as an alias for +standard input. =item A scalar reference -If C<$input> is a scalar reference, the input data will be read -from C<$$input>. +If C<$input_filename_or_reference> is a scalar reference, the input data +will be read from C<$$input_filename_or_reference>. =item An array reference -If C<$input> is an array reference, each element in the array must be a -filename. +If C<$input_filename_or_reference> is an array reference, each element in +the array must be a filename. The input data will be read from each file in turn. @@ -457,64 +458,71 @@ 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 ">" -C<rawinflate> will assume that it is an I<input fileglob string>. The -input is the list of files that match the fileglob. +If C<$input_filename_or_reference> 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. See L<File::GlobMapper|File::GlobMapper> for more details. =back -If the C<$input> parameter is any other type, C<undef> will be returned. +If the C<$input_filename_or_reference> parameter is any other type, +C<undef> will be returned. -=head3 The C<$output> parameter +=head3 The C<$output_filename_or_reference> parameter -The parameter C<$output> is used to control the destination of the -uncompressed data. This parameter can take one of these forms. +The parameter C<$output_filename_or_reference> is used to control the +destination of the uncompressed data. This parameter can take one of +these forms. =over 5 =item A filename -If the C<$output> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for writing and the uncompressed -data will be written to it. +If the C<$output_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for writing and the +uncompressed data will be written to it. =item A filehandle -If the C<$output> parameter is a filehandle, the uncompressed data -will be written to it. -The string '-' can be used as an alias for standard output. +If the C<$output_filename_or_reference> parameter is a filehandle, the +uncompressed data will be written to it. The string '-' can be used as +an alias for standard output. =item A scalar reference -If C<$output> is a scalar reference, the uncompressed data will be -stored in C<$$output>. +If C<$output_filename_or_reference> is a scalar reference, the +uncompressed data will be stored in C<$$output_filename_or_reference>. =item An Array Reference -If C<$output> is an array reference, the uncompressed data will be -pushed onto the array. +If C<$output_filename_or_reference> is an array reference, +the uncompressed data will be pushed onto the array. =item An Output FileGlob -If C<$output> is a string that is delimited by the characters "<" and ">" -C<rawinflate> will assume that it is an I<output fileglob string>. The -output is the list of files that match the fileglob. +If C<$output_filename_or_reference> is a string that is delimited by the +characters "<" and ">" C<rawinflate> will assume that it is an +I<output fileglob string>. The 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. +When C<$output_filename_or_reference> is an fileglob string, +C<$input_filename_or_reference> 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. +If the C<$output_filename_or_reference> 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 +When C<$input_filename_or_reference> maps to multiple compressed +files/buffers and C<$output_filename_or_reference> is +a single file/buffer, after uncompression C<$output_filename_or_reference> will contain a concatenation of all the uncompressed data from each of the input files/buffers. @@ -709,7 +717,7 @@ 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 -C<$$output>. +C<$$input>. =back @@ -922,6 +930,13 @@ 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. +Note that the implementation of C<seek> in this module does not provide +true random access to a compressed file/buffer. It works by uncompressing +data from the current offset in the file/buffer until it reaches the +ucompressed offset specified in the parameters to C<seek>. For very small +files this may be acceptable behaviour. For large files it may cause an +unacceptable delay. + The C<$whence> parameter takes one the usual values, namely SEEK_SET, SEEK_CUR or SEEK_END. @@ -1068,7 +1083,7 @@ Same as doing this =head2 Working with Net::FTP -See L<IO::Uncompress::RawInflate::FAQ|IO::Uncompress::RawInflate::FAQ/"Compressed files and Net::FTP"> +See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> =head1 SEE ALSO @@ -1103,7 +1118,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2012 Paul Marquess. All rights reserved. +Copyright (c) 2005-2013 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 7b2121c4e75..4175136fc3c 100644 --- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm +++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm @@ -6,24 +6,24 @@ require 5.006 ; use strict ; use warnings; -use bytes; +#use bytes; use IO::File; -use IO::Uncompress::RawInflate 2.048 ; -use IO::Compress::Base::Common 2.048 qw(:Status createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.048 ; -use IO::Uncompress::Adapter::Identity 2.048 ; -use IO::Compress::Zlib::Extra 2.048 ; -use IO::Compress::Zip::Constants 2.048 ; +use IO::Uncompress::RawInflate 2.060 ; +use IO::Compress::Base::Common 2.060 qw(:Status ); +use IO::Uncompress::Adapter::Inflate 2.060 ; +use IO::Uncompress::Adapter::Identity 2.060 ; +use IO::Compress::Zlib::Extra 2.060 ; +use IO::Compress::Zip::Constants 2.060 ; -use Compress::Raw::Zlib 2.048 () ; +use Compress::Raw::Zlib 2.060 () ; BEGIN { - eval { require IO::Uncompress::Adapter::Bunzip2 ; + eval{ require IO::Uncompress::Adapter::Bunzip2 ; import IO::Uncompress::Adapter::Bunzip2 } ; - eval { require IO::Uncompress::Adapter::UnLzma ; - import IO::Uncompress::Adapter::UnLzma } ; + eval{ require IO::Uncompress::Adapter::UnLzma ; + import IO::Uncompress::Adapter::UnLzma } ; } @@ -31,7 +31,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup); -$VERSION = '2.048'; +$VERSION = '2.060'; $UnzipError = ''; @ISA = qw(Exporter IO::Uncompress::RawInflate); @@ -52,27 +52,25 @@ Exporter::export_ok_tags('all'); sub new { my $class = shift ; - my $obj = createSelfTiedObject($class, \$UnzipError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$UnzipError); $obj->_create(undef, 0, @_); } sub unzip { - my $obj = createSelfTiedObject(undef, \$UnzipError); + my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$UnzipError); return $obj->_inf(@_) ; } sub getExtraParams { - use IO::Compress::Base::Common 2.048 qw(:Parse); - - + return ( # # Zip header fields - 'Name' => [1, 1, Parse_any, undef], - - 'Stream' => [1, 1, Parse_boolean, 0], + 'name' => [IO::Compress::Base::Common::Parse_any, undef], + 'stream' => [IO::Compress::Base::Common::Parse_boolean, 0], + # TODO - This means reading the central directory to get # 1. the local header offsets # 2. The compressed data length @@ -85,9 +83,9 @@ sub ckParams my $got = shift ; # unzip always needs crc32 - $got->value('CRC32' => 1); + $got->setValue('crc32' => 1); - *$self->{UnzipData}{Name} = $got->value('Name'); + *$self->{UnzipData}{Name} = $got->getValue('name'); return 1; } @@ -1098,19 +1096,20 @@ section. use IO::Uncompress::Unzip qw(unzip $UnzipError) ; - unzip $input => $output [,OPTS] + unzip $input_filename_or_reference => $output_filename_or_reference [,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>. +C<unzip> expects at least two parameters, +C<$input_filename_or_reference> and C<$output_filename_or_reference>. -=head3 The C<$input> parameter +=head3 The C<$input_filename_or_reference> parameter -The parameter, C<$input>, is used to define the source of -the compressed data. +The parameter, C<$input_filename_or_reference>, is used to define the +source of the compressed data. It can take one of the following forms: @@ -1118,25 +1117,25 @@ It can take one of the following forms: =item A filename -If the C<$input> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for reading and the input data -will be read from it. +If the <$input_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for reading and the +input data will be read from it. =item A filehandle -If the C<$input> parameter is a filehandle, the input data will be -read from it. -The string '-' can be used as an alias for standard input. +If the C<$input_filename_or_reference> parameter is a filehandle, the input +data will be read from it. The string '-' can be used as an alias for +standard input. =item A scalar reference -If C<$input> is a scalar reference, the input data will be read -from C<$$input>. +If C<$input_filename_or_reference> is a scalar reference, the input data +will be read from C<$$input_filename_or_reference>. =item An array reference -If C<$input> is an array reference, each element in the array must be a -filename. +If C<$input_filename_or_reference> is an array reference, each element in +the array must be a filename. The input data will be read from each file in turn. @@ -1145,64 +1144,71 @@ 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 ">" -C<unzip> will assume that it is an I<input fileglob string>. The -input is the list of files that match the fileglob. +If C<$input_filename_or_reference> 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. See L<File::GlobMapper|File::GlobMapper> for more details. =back -If the C<$input> parameter is any other type, C<undef> will be returned. +If the C<$input_filename_or_reference> parameter is any other type, +C<undef> will be returned. -=head3 The C<$output> parameter +=head3 The C<$output_filename_or_reference> parameter -The parameter C<$output> is used to control the destination of the -uncompressed data. This parameter can take one of these forms. +The parameter C<$output_filename_or_reference> is used to control the +destination of the uncompressed data. This parameter can take one of +these forms. =over 5 =item A filename -If the C<$output> parameter is a simple scalar, it is assumed to be a -filename. This file will be opened for writing and the uncompressed -data will be written to it. +If the C<$output_filename_or_reference> parameter is a simple scalar, it is +assumed to be a filename. This file will be opened for writing and the +uncompressed data will be written to it. =item A filehandle -If the C<$output> parameter is a filehandle, the uncompressed data -will be written to it. -The string '-' can be used as an alias for standard output. +If the C<$output_filename_or_reference> parameter is a filehandle, the +uncompressed data will be written to it. The string '-' can be used as +an alias for standard output. =item A scalar reference -If C<$output> is a scalar reference, the uncompressed data will be -stored in C<$$output>. +If C<$output_filename_or_reference> is a scalar reference, the +uncompressed data will be stored in C<$$output_filename_or_reference>. =item An Array Reference -If C<$output> is an array reference, the uncompressed data will be -pushed onto the array. +If C<$output_filename_or_reference> is an array reference, +the uncompressed data will be pushed onto the array. =item An Output FileGlob -If C<$output> is a string that is delimited by the characters "<" and ">" -C<unzip> will assume that it is an I<output fileglob string>. The -output is the list of files that match the fileglob. +If C<$output_filename_or_reference> is a string that is delimited by the +characters "<" and ">" C<unzip> will assume that it is an +I<output fileglob string>. The 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. +When C<$output_filename_or_reference> is an fileglob string, +C<$input_filename_or_reference> 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. +If the C<$output_filename_or_reference> 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 +When C<$input_filename_or_reference> maps to multiple compressed +files/buffers and C<$output_filename_or_reference> is +a single file/buffer, after uncompression C<$output_filename_or_reference> will contain a concatenation of all the uncompressed data from each of the input files/buffers. @@ -1403,7 +1409,7 @@ 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 -C<$$output>. +C<$$input>. =back @@ -1623,6 +1629,13 @@ 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. +Note that the implementation of C<seek> in this module does not provide +true random access to a compressed file/buffer. It works by uncompressing +data from the current offset in the file/buffer until it reaches the +ucompressed offset specified in the parameters to C<seek>. For very small +files this may be acceptable behaviour. For large files it may cause an +unacceptable delay. + The C<$whence> parameter takes one the usual values, namely SEEK_SET, SEEK_CUR or SEEK_END. @@ -1769,7 +1782,7 @@ Same as doing this =head2 Working with Net::FTP -See L<IO::Uncompress::Unzip::FAQ|IO::Uncompress::Unzip::FAQ/"Compressed files and Net::FTP"> +See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> =head2 Walking through a zip file @@ -1783,7 +1796,7 @@ stream at a time. or die "Cannot open $zipfile: $UnzipError"; my $status; - for ($status = 1; $stream > 0; $status = $u->nextStream()) + for ($status = 1; $status > 0; $status = $u->nextStream()) { my $name = $u->getHeaderInfo()->{Name}; @@ -1841,7 +1854,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2012 Paul Marquess. All rights reserved. +Copyright (c) 2005-2013 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. |