diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm | 165 |
1 files changed, 106 insertions, 59 deletions
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm index 7c5dc793e71..fc62b4f4f95 100644 --- a/Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm +++ b/Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm @@ -5,16 +5,16 @@ use warnings; use bytes; require Exporter ; -use IO::Compress::Base 2.060 ; +use IO::Compress::Base 2.064 ; -use IO::Compress::Base::Common 2.060 qw(); -use IO::Compress::Adapter::Bzip2 2.060 ; +use IO::Compress::Base::Common 2.064 qw(); +use IO::Compress::Adapter::Bzip2 2.064 ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error); -$VERSION = '2.060'; +$VERSION = '2.064'; $Bzip2Error = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -51,7 +51,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.060 qw(:Parse); + use IO::Compress::Base::Common 2.064 qw(:Parse); return ( 'blocksize100k' => [IO::Compress::Base::Common::Parse_unsigned, 1], @@ -204,19 +204,20 @@ section. use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ; - bzip2 $input => $output [,OPTS] + bzip2 $input_filename_or_reference => $output_filename_or_reference [,OPTS] or die "bzip2 failed: $Bzip2Error\n"; The functional interface needs Perl5.005 or better. -=head2 bzip2 $input => $output [, OPTS] +=head2 bzip2 $input_filename_or_reference => $output_filename_or_reference [, OPTS] -C<bzip2> expects at least two parameters, C<$input> and C<$output>. +C<bzip2> 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 uncompressed data. +The parameter, C<$input_filename_or_reference>, is used to define the +source of the uncompressed data. It can take one of the following forms: @@ -224,25 +225,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. @@ -251,65 +252,72 @@ contains valid filenames before any data is compressed. =item An Input FileGlob string -If C<$input> is a string that is delimited by the characters "<" and ">" -C<bzip2> 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<bzip2> 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 -compressed data. This parameter can take one of these forms. +The parameter C<$output_filename_or_reference> is used to control the +destination of the compressed 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 compressed -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 +compressed data will be written to it. =item A filehandle -If the C<$output> parameter is a filehandle, the compressed 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 +compressed 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 compressed data will be -stored in C<$$output>. +If C<$output_filename_or_reference> is a scalar reference, the +compressed data will be stored in C<$$output_filename_or_reference>. =item An Array Reference -If C<$output> is an array reference, the compressed data will be -pushed onto the array. +If C<$output_filename_or_reference> is an array reference, +the compressed 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<bzip2> 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<bzip2> 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 files/buffers and C<$output> is a single +When C<$input_filename_or_reference> maps to multiple files/buffers and +C<$output_filename_or_reference> is a single file/buffer the input files/buffers will be stored -in C<$output> as a concatenated series of compressed data streams. +in C<$output_filename_or_reference> as a concatenated series of compressed data streams. =head2 Optional Parameters @@ -338,7 +346,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 compressed data will be append to the end of +the output buffer. Otherwise the output buffer will be cleared before any +compressed 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 compressed +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 compressed 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 compressed +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 compressed data. If the output is a filename, it will be opened for +appending. If the output is a buffer, all compressed 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 compressed 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 compressed data is output. + +Defaults to 0. =back @@ -467,7 +516,7 @@ The behaviour of this option is dependent on the type of C<$output>. =item * A Buffer If C<$output> is a buffer and C<Append> is enabled, all compressed data -will be append to the end if C<$output>. Otherwise C<$output> will be +will be append to the end of C<$output>. Otherwise C<$output> will be cleared before any data is written to it. =item * A Filename @@ -657,7 +706,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 @@ -693,7 +742,7 @@ Usage is Closes the current compressed data stream and starts a new one. -OPTS consists of any of the the options that are available when creating +OPTS consists of any of the options that are available when creating the C<$z> object. See the L</"Constructor Options"> section for more details. @@ -719,19 +768,17 @@ Same as doing this =head2 Apache::GZip Revisited -See L<IO::Compress::Bzip2::FAQ|IO::Compress::Bzip2::FAQ/"Apache::GZip Revisited"> - - +See L<IO::Compress::FAQ|IO::Compress::FAQ/"Apache::GZip Revisited"> =head2 Working with Net::FTP -See L<IO::Compress::Bzip2::FAQ|IO::Compress::Bzip2::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::Uncompress::Bunzip2>, 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::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> -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>, @@ -751,7 +798,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. |