diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm b/Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm index b2f38ff4021..c833f5e98b0 100644 --- a/Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm +++ b/Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm @@ -6,15 +6,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base 2.084 ; -use IO::Compress::Base::Common 2.084 qw(:Status ); -use IO::Compress::Adapter::Deflate 2.084 ; +use IO::Compress::Base 2.093 ; +use IO::Compress::Base::Common 2.093 qw(:Status ); +use IO::Compress::Adapter::Deflate 2.093 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); -$VERSION = '2.084'; +$VERSION = '2.093'; $RawDeflateError = ''; @ISA = qw(IO::Compress::Base Exporter); @@ -116,8 +116,8 @@ sub getExtraParams return getZlibParams(); } -use IO::Compress::Base::Common 2.084 qw(:Parse); -use Compress::Raw::Zlib 2.084 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); +use IO::Compress::Base::Common 2.093 qw(:Parse); +use Compress::Raw::Zlib 2.093 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); our %PARAMS = ( #'method' => [IO::Compress::Base::Common::Parse_unsigned, Z_DEFLATED], 'level' => [IO::Compress::Base::Common::Parse_signed, Z_DEFAULT_COMPRESSION], @@ -265,7 +265,6 @@ IO::Compress::RawDeflate - Write RFC 1951 files/buffers binmode $z fileno $z close $z ; - =head1 DESCRIPTION @@ -295,7 +294,8 @@ The functional interface needs Perl5.005 or better. =head2 rawdeflate $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<rawdeflate> expects at least two parameters, -C<$input_filename_or_reference> and C<$output_filename_or_reference>. +C<$input_filename_or_reference> and C<$output_filename_or_reference> +and zero or more optional parameters (see L</Optional Parameters>) =head3 The C<$input_filename_or_reference> parameter @@ -308,7 +308,7 @@ It can take one of the following forms: =item A filename -If the <$input_filename_or_reference> parameter is a simple scalar, it is +If the C<$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. @@ -404,9 +404,9 @@ in C<$output_filename_or_reference> as a concatenated series of compressed data =head2 Optional Parameters -Unless specified below, the optional parameters for C<rawdeflate>, -C<OPTS>, are the same as those used with the OO interface defined in the -L</"Constructor Options"> section below. +The optional parameters for the one-shot function C<rawdeflate> +are (for the most part) identical to those used with the OO interface defined in the +L</"Constructor Options"> section. The exceptions are listed below =over 5 @@ -474,6 +474,22 @@ Defaults to 0. =head2 Examples +Here are a few example that show the capabilities of the module. + +=head3 Streaming + +This very simple command line example demonstrates the streaming capabilities of the module. +The code reads data from STDIN, compresses it, and writes the compressed data to STDOUT. + + $ echo hello world | perl -MIO::Compress::RawDeflate=rawdeflate -e 'rawdeflate \*STDIN => \*STDOUT' >output.1951 + +The special filename "-" can be used as a standin for both C<\*STDIN> and C<\*STDOUT>, +so the above can be rewritten as + + $ echo hello world | perl -MIO::Compress::RawDeflate=rawdeflate -e 'rawdeflate "-" => "-"' >output.1951 + +=head3 Compressing a file from the filesystem + To read the contents of the file C<file1.txt> and write the compressed data to the file C<file1.txt.1951>. @@ -485,6 +501,8 @@ data to the file C<file1.txt.1951>. rawdeflate $input => "$input.1951" or die "rawdeflate failed: $RawDeflateError\n"; +=head3 Reading from a Filehandle and writing to an in-memory buffer + To read from an existing Perl filehandle, C<$input>, and write the compressed data to a buffer, C<$buffer>. @@ -499,6 +517,8 @@ compressed data to a buffer, C<$buffer>. rawdeflate $input => \$buffer or die "rawdeflate failed: $RawDeflateError\n"; +=head3 Compressing multiple files + To compress all files in the directory "/my/home" that match "*.txt" and store the compressed data in the same directory @@ -573,7 +593,7 @@ return undef. =head2 Constructor Options -C<OPTS> is any combination of the following options: +C<OPTS> is any combination of zero or more the following options: =over 5 @@ -948,6 +968,12 @@ See L<IO::Compress::FAQ|IO::Compress::FAQ/"Apache::GZip Revisited"> See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP"> +=head1 SUPPORT + +General feedback/questions/bug reports should be sent to +L<https://github.com/pmqs/IO-Compress/issues> (preferred) or +L<https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Compress>. + =head1 SEE ALSO L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, 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> |