diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm | 103 |
1 files changed, 48 insertions, 55 deletions
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm index 379ad9cd73d..1ca86c9331c 100644 --- a/Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm +++ b/Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm @@ -8,16 +8,16 @@ use bytes; require Exporter ; -use IO::Compress::RawDeflate 2.074 (); -use IO::Compress::Adapter::Deflate 2.074 ; +use IO::Compress::RawDeflate 2.084 (); +use IO::Compress::Adapter::Deflate 2.084 ; -use IO::Compress::Zlib::Constants 2.074 ; -use IO::Compress::Base::Common 2.074 qw(); +use IO::Compress::Zlib::Constants 2.084 ; +use IO::Compress::Base::Common 2.084 qw(); our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $DeflateError); -$VERSION = '2.074'; +$VERSION = '2.084'; $DeflateError = ''; @ISA = qw(IO::Compress::RawDeflate Exporter); @@ -170,14 +170,12 @@ __END__ =head1 NAME IO::Compress::Deflate - Write RFC 1950 files/buffers - - =head1 SYNOPSIS use IO::Compress::Deflate qw(deflate $DeflateError) ; - my $status = deflate $input => $output [,OPTS] + my $status = deflate $input => $output [,OPTS] or die "deflate failed: $DeflateError\n"; my $z = new IO::Compress::Deflate $output [,OPTS] @@ -197,9 +195,9 @@ IO::Compress::Deflate - Write RFC 1950 files/buffers $z->autoflush(); $z->input_line_number(); $z->newStream( [OPTS] ); - + $z->deflateParams(); - + $z->close() ; $DeflateError ; @@ -214,14 +212,14 @@ IO::Compress::Deflate - Write RFC 1950 files/buffers binmode $z fileno $z close $z ; - + =head1 DESCRIPTION This module provides a Perl interface that allows writing compressed data to files or buffer as defined in RFC 1950. -For reading RFC 1950 files/buffers, see the companion module +For reading RFC 1950 files/buffers, see the companion module L<IO::Uncompress::Inflate|IO::Uncompress::Inflate>. =head1 Functional Interface @@ -233,7 +231,7 @@ section. use IO::Compress::Deflate qw(deflate $DeflateError) ; - deflate $input_filename_or_reference => $output_filename_or_reference [,OPTS] + deflate $input_filename_or_reference => $output_filename_or_reference [,OPTS] or die "deflate failed: $DeflateError\n"; The functional interface needs Perl5.005 or better. @@ -246,7 +244,7 @@ C<$input_filename_or_reference> and C<$output_filename_or_reference>. =head3 The C<$input_filename_or_reference> parameter The parameter, C<$input_filename_or_reference>, is used to define the -source of the uncompressed data. +source of the uncompressed data. It can take one of the following forms: @@ -264,17 +262,17 @@ 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 +=item A scalar reference 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 +=item An array reference 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. +The input data will be read from each file in turn. The complete array will be walked to ensure that it only contains valid filenames before any data is compressed. @@ -282,8 +280,8 @@ contains valid filenames before any data is compressed. =item An Input FileGlob string If C<$input_filename_or_reference> is a string that is delimited by the -characters "<" and ">" C<deflate> will assume that it is an -I<input fileglob string>. The input is the list of files that match the +characters "<" and ">" C<deflate> 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. @@ -304,7 +302,7 @@ these forms. =item A filename 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 +assumed to be a filename. This file will be opened for writing and the compressed data will be written to it. =item A filehandle @@ -313,14 +311,14 @@ 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 +=item A scalar reference 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_filename_or_reference> is an array reference, +If C<$output_filename_or_reference> is an array reference, the compressed data will be pushed onto the array. =item An Output FileGlob @@ -358,7 +356,7 @@ L</"Constructor Options"> section below. =item C<< AutoClose => 0|1 >> -This option applies to any input or output data streams to +This option applies to any input or output data streams to C<deflate> that are filehandles. If C<AutoClose> is specified, and the value is true, it will result in all @@ -369,9 +367,7 @@ This parameter defaults to 0. =item C<< BinModeIn => 0|1 >> -When reading from a file or filehandle, set C<binmode> before reading. - -Defaults to 0. +This option is now a no-op. All files will be read in binmode. =item C<< Append => 0|1 >> @@ -400,7 +396,7 @@ 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 +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 @@ -444,7 +440,7 @@ compressed data to a buffer, C<$buffer>. my $input = new IO::File "<file1.txt" or die "Cannot open 'file1.txt': $!\n" ; my $buffer ; - deflate $input => \$buffer + deflate $input => \$buffer or die "deflate failed: $DeflateError\n"; To compress all files in the directory "/my/home" that match "*.txt" @@ -466,7 +462,7 @@ and if you want to compress each file one at a time, this will do the trick for my $input ( glob "/my/home/*.txt" ) { my $output = "$input.1950" ; - deflate $input => $output + deflate $input => $output or die "Error compressing '$input': $DeflateError\n"; } @@ -479,14 +475,14 @@ The format of the constructor for C<IO::Compress::Deflate> is shown below my $z = new IO::Compress::Deflate $output [,OPTS] or die "IO::Compress::Deflate failed: $DeflateError\n"; -It returns an C<IO::Compress::Deflate> object on success and undef on failure. +It returns an C<IO::Compress::Deflate> object on success and undef on failure. The variable C<$DeflateError> will contain an error message on failure. -If you are running Perl 5.005 or better the object, C<$z>, returned from -IO::Compress::Deflate can be used exactly like an L<IO::File|IO::File> filehandle. -This means that all normal output file operations can be carried out -with C<$z>. -For example, to write to a compressed file/buffer you can use either of +If you are running Perl 5.005 or better the object, C<$z>, returned from +IO::Compress::Deflate can be used exactly like an L<IO::File|IO::File> filehandle. +This means that all normal output file operations can be carried out +with C<$z>. +For example, to write to a compressed file/buffer you can use either of these forms $z->print("hello world\n"); @@ -509,7 +505,7 @@ 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. -=item A scalar reference +=item A scalar reference If C<$output> is a scalar reference, the compressed data will be stored in C<$$output>. @@ -536,7 +532,7 @@ This parameter defaults to 0. =item C<< Append => 0|1 >> -Opens C<$output> in append mode. +Opens C<$output> in append mode. The behaviour of this option is dependent on the type of C<$output>. @@ -568,20 +564,20 @@ This parameter defaults to 0. This option is used to compress input data and append it to an existing compressed data stream in C<$output>. The end result is a single compressed -data stream stored in C<$output>. +data stream stored in C<$output>. It is a fatal error to attempt to use this option when C<$output> is not an RFC 1950 data stream. There are a number of other limitations with the C<Merge> option: -=over 5 +=over 5 =item 1 This module needs to have been built with zlib 1.2.1 or better to work. A fatal error will be thrown if C<Merge> is used with an older version of -zlib. +zlib. =item 2 @@ -591,7 +587,7 @@ If C<$output> is a file or a filehandle, it must be seekable. This parameter defaults to 0. -=item -Level +=item -Level Defines the compression level used by zlib. The value should either be a number between 0 and 9 (0 means no compression and 9 is maximum @@ -610,7 +606,7 @@ Note, these constants are not imported by C<IO::Compress::Deflate> by default. use IO::Compress::Deflate qw(:constants); use IO::Compress::Deflate qw(:all); -=item -Strategy +=item -Strategy Defines the strategy used to tune the compression. Use one of the symbolic constants defined below. @@ -633,7 +629,7 @@ This is a placeholder option. TODO -=head1 Methods +=head1 Methods =head2 print @@ -751,7 +747,7 @@ This is a noop provided for completeness. $z->opened() -Returns true if the object currently refers to a opened file/buffer. +Returns true if the object currently refers to a opened file/buffer. =head2 autoflush @@ -774,7 +770,7 @@ retrieve the autoflush setting. $z->input_line_number() $z->input_line_number(EXPR) -This method always returns C<undef> when compressing. +This method always returns C<undef> when compressing. =head2 fileno @@ -793,7 +789,7 @@ C<undef>. $z->close() ; close $z ; -Flushes any pending compressed data and then closes the output file/buffer. +Flushes any pending compressed data and then closes the output file/buffer. For most versions of Perl this method will be automatically invoked if the IO::Compress::Deflate object is destroyed (either explicitly or by the @@ -834,9 +830,9 @@ Usage is TODO -=head1 Importing +=head1 Importing -A number of symbolic constants are required by some methods in +A number of symbolic constants are required by some methods in C<IO::Compress::Deflate>. None are imported by default. =over 5 @@ -884,9 +880,6 @@ These symbolic constants are used by the C<Strategy> option in the constructor. Z_FIXED Z_DEFAULT_STRATEGY - - - =back =head1 EXAMPLES @@ -901,7 +894,7 @@ 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::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> +L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzip>, L<IO::Uncompress::UnLzip>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Compress::Zstd>, L<IO::Uncompress::UnZstd>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> L<IO::Compress::FAQ|IO::Compress::FAQ> @@ -909,7 +902,7 @@ L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>, L<Archive::Tar|Archive::Tar>, L<IO::Zlib|IO::Zlib> -For RFC 1950, 1951 and 1952 see +For RFC 1950, 1951 and 1952 see L<http://www.faqs.org/rfcs/rfc1950.html>, L<http://www.faqs.org/rfcs/rfc1951.html> and L<http://www.faqs.org/rfcs/rfc1952.html> @@ -924,7 +917,7 @@ The primary site for gzip is L<http://www.gzip.org>. =head1 AUTHOR -This module was written by Paul Marquess, C<pmqs@cpan.org>. +This module was written by Paul Marquess, C<pmqs@cpan.org>. =head1 MODIFICATION HISTORY @@ -932,7 +925,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2017 Paul Marquess. All rights reserved. +Copyright (c) 2005-2019 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. |