diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm | 158 |
1 files changed, 86 insertions, 72 deletions
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. |