summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm174
1 files changed, 115 insertions, 59 deletions
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm
index ccfb69b2bd8..aad835f32f3 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.060 qw(:Status );
+use IO::Compress::Base::Common 2.064 qw(:Status );
-use IO::Uncompress::Base 2.060 ;
-use IO::Uncompress::Adapter::Bunzip2 2.060 ;
+use IO::Uncompress::Base 2.064 ;
+use IO::Uncompress::Adapter::Bunzip2 2.064 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error);
-$VERSION = '2.060';
+$VERSION = '2.064';
$Bunzip2Error = '';
@ISA = qw( Exporter IO::Uncompress::Base );
@@ -201,19 +201,20 @@ section.
use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
- bunzip2 $input => $output [,OPTS]
+ bunzip2 $input_filename_or_reference => $output_filename_or_reference [,OPTS]
or die "bunzip2 failed: $Bunzip2Error\n";
The functional interface needs Perl5.005 or better.
-=head2 bunzip2 $input => $output [, OPTS]
+=head2 bunzip2 $input_filename_or_reference => $output_filename_or_reference [, OPTS]
-C<bunzip2> expects at least two parameters, C<$input> and C<$output>.
+C<bunzip2> 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:
@@ -221,25 +222,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.
@@ -248,64 +249,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<bunzip2> 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 ...
+If C<$input_filename_or_reference> is a string that is delimited by the
+characters "<" and ">" C<bunzip2> 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<bunzip2> 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<bunzip2> 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.
@@ -337,7 +345,48 @@ Defaults to 0.
=item C<< Append => 0|1 >>
-TODO
+The behaviour of this option is dependent on the type of output data
+stream.
+
+=over 5
+
+=item * A Buffer
+
+If C<Append> is enabled, all uncompressed data will be append to the end of
+the output buffer. Otherwise the output buffer will be cleared before any
+uncompressed data is written to it.
+
+=item * A Filename
+
+If C<Append> is enabled, the file will be opened in append mode. Otherwise
+the contents of the file, if any, will be truncated before any uncompressed
+data is written to it.
+
+=item * A Filehandle
+
+If C<Append> is enabled, the filehandle will be positioned to the end of
+the file via a call to C<seek> before any uncompressed data is
+written to it. Otherwise the file pointer will not be moved.
+
+=back
+
+When C<Append> is specified, and set to true, it will I<append> all uncompressed
+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
+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.
+
+When the output is a filename, it will truncate the contents of the file
+before writing any uncompressed data. If the output is a filehandle
+its position will not be changed. If the output is a buffer, it will be
+wiped before any uncompressed data is output.
+
+Defaults to 0.
=item C<< MultiStream => 0|1 >>
@@ -374,7 +423,7 @@ C<InputLength> option.
=head2 Examples
To read the contents of the file C<file1.txt.bz2> and write the
-compressed data to the file C<file1.txt>.
+uncompressed data to the file C<file1.txt>.
use strict ;
use warnings ;
@@ -462,7 +511,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
@@ -517,7 +566,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.
@@ -580,7 +629,7 @@ Usage is
$status = $z->read($buffer)
-Reads a block of compressed data (the size the the compressed block is
+Reads a block of compressed data (the size of the compressed block is
determined by the C<Buffer> option in the constructor), uncompresses it and
writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
set in the constructor, the uncompressed data will be appended to the
@@ -618,7 +667,7 @@ Usage is
Reads a single line.
-This method fully supports the use of of the variable C<$/> (or
+This method fully supports the use of the variable C<$/> (or
C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
determine what constitutes an end of line. Paragraph mode, record mode and
file slurp mode are all supported.
@@ -675,6 +724,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
+uncompressed 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.
@@ -720,7 +776,7 @@ Returns the current uncompressed line number. If C<EXPR> is present it has
the effect of setting the line number. Note that setting the line number
does not change the current position within the file/buffer being read.
-The contents of C<$/> are used to to determine what constitutes a line
+The contents of C<$/> are used to determine what constitutes a line
terminator.
=head2 fileno
@@ -732,7 +788,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno>
will return the underlying file descriptor. Once the C<close> method is
called C<fileno> will return C<undef>.
-If the C<$z> object is is associated with a buffer, this method will return
+If the C<$z> object is associated with a buffer, this method will return
C<undef>.
=head2 close
@@ -821,13 +877,13 @@ Same as doing this
=head2 Working with Net::FTP
-See L<IO::Uncompress::Bunzip2::FAQ|IO::Uncompress::Bunzip2::FAQ/"Compressed files and Net::FTP">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP">
=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::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
+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::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>
-L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
+L<IO::Compress::FAQ|IO::Compress::FAQ>
L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
L<Archive::Tar|Archive::Tar>,
@@ -847,7 +903,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 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.