diff options
author | Norbert Preining <norbert@preining.info> | 2021-04-02 03:20:54 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-04-02 03:20:54 +0000 |
commit | 3f173002d4a4a84e7d1fa5a74755fdd00d08a9c2 (patch) | |
tree | 5ed380344702de1f9ab53b68b6c3bcd6b8458087 /systems/texlive/tlnet/tlpkg/tlperl/lib/IO | |
parent | f78ba658b3ecd56053fe0837a4404d0c6c16a707 (diff) |
CTAN sync 202104020320
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tlperl/lib/IO')
36 files changed, 1162 insertions, 485 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Bzip2.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Bzip2.pm index 623a2c671a..a8a7762ce7 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Bzip2.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Bzip2.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.084 qw(:Status); +use IO::Compress::Base::Common 2.093 qw(:Status); -use Compress::Raw::Bzip2 2.084 ; +use Compress::Raw::Bzip2 2.093 ; our ($VERSION); -$VERSION = '2.084'; +$VERSION = '2.093'; sub mkCompObject { diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Deflate.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Deflate.pm index 8903287b10..140d29ff29 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Deflate.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Deflate.pm @@ -4,13 +4,13 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.084 qw(:Status); -use Compress::Raw::Zlib 2.084 qw( !crc32 !adler32 ) ; +use IO::Compress::Base::Common 2.093 qw(:Status); +use Compress::Raw::Zlib 2.093 qw( !crc32 !adler32 ) ; require Exporter; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, @EXPORT, %DEFLATE_CONSTANTS); -$VERSION = '2.084'; +$VERSION = '2.093'; @ISA = qw(Exporter); @EXPORT_OK = @Compress::Raw::Zlib::DEFLATE_CONSTANTS; %EXPORT_TAGS = %Compress::Raw::Zlib::DEFLATE_CONSTANTS; diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Identity.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Identity.pm index ae23102a24..487cfa7b47 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Identity.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Adapter/Identity.pm @@ -4,10 +4,10 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.084 qw(:Status); +use IO::Compress::Base::Common 2.093 qw(:Status); our ($VERSION); -$VERSION = '2.084'; +$VERSION = '2.093'; sub mkCompObject { diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Base.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Base.pm index 1e2a54ba39..f817d13b47 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Base.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Base.pm @@ -6,7 +6,7 @@ require 5.006 ; use strict ; use warnings; -use IO::Compress::Base::Common 2.084 ; +use IO::Compress::Base::Common 2.093 ; use IO::File (); ; use Scalar::Util (); @@ -20,7 +20,7 @@ use Symbol(); our (@ISA, $VERSION); @ISA = qw(IO::File Exporter); -$VERSION = '2.084'; +$VERSION = '2.093'; #Can't locate object method "SWASHNEW" via package "utf8" (perhaps you forgot to load "utf8"?) at .../ext/Compress-Zlib/Gzip/blib/lib/Compress/Zlib/Common.pm line 16. @@ -1021,6 +1021,12 @@ IO::Compress::Base - Base Class for IO::Compress modules This module is not intended for direct use in application code. Its sole purpose is to be sub-classed by IO::Compress modules. +=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::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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Base/Common.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Base/Common.pm index 53232898c4..87af18b6de 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Base/Common.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Base/Common.pm @@ -11,7 +11,7 @@ use File::GlobMapper; require Exporter; our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE); @ISA = qw(Exporter); -$VERSION = '2.084'; +$VERSION = '2.093'; @EXPORT = qw( isaFilehandle isaFilename isaScalar whatIsInput whatIsOutput diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm index 1c0d027abd..13d3b4674d 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm @@ -5,16 +5,16 @@ use warnings; use bytes; require Exporter ; -use IO::Compress::Base 2.084 ; +use IO::Compress::Base 2.093 ; -use IO::Compress::Base::Common 2.084 qw(); -use IO::Compress::Adapter::Bzip2 2.084 ; +use IO::Compress::Base::Common 2.093 qw(); +use IO::Compress::Adapter::Bzip2 2.093 ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error); -$VERSION = '2.084'; +$VERSION = '2.093'; $Bzip2Error = ''; @ISA = qw(IO::Compress::Base Exporter); @@ -51,7 +51,7 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.084 qw(:Parse); + use IO::Compress::Base::Common 2.093 qw(:Parse); return ( 'blocksize100k' => [IO::Compress::Base::Common::Parse_unsigned, 1], @@ -183,7 +183,6 @@ IO::Compress::Bzip2 - Write bzip2 files/buffers binmode $z fileno $z close $z ; - =head1 DESCRIPTION @@ -210,7 +209,8 @@ The functional interface needs Perl5.005 or better. =head2 bzip2 $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<bzip2> 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 @@ -223,7 +223,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. @@ -319,9 +319,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<bzip2>, -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<bzip2> +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 @@ -389,6 +389,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::Bzip2=bzip2 -e 'bzip2 \*STDIN => \*STDOUT' >output.bz2 + +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::Bzip2=bzip2 -e 'bzip2 "-" => "-"' >output.bz2 + +=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.bz2>. @@ -400,6 +416,8 @@ data to the file C<file1.txt.bz2>. bzip2 $input => "$input.bz2" or die "bzip2 failed: $Bzip2Error\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>. @@ -414,6 +432,8 @@ compressed data to a buffer, C<$buffer>. bzip2 $input => \$buffer or die "bzip2 failed: $Bzip2Error\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 @@ -488,7 +508,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 @@ -768,6 +788,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::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::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> @@ -778,7 +804,7 @@ L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>, L<Archive::Tar|Archive::Tar>, L<IO::Zlib|IO::Zlib> -The primary site for the bzip2 program is L<http://www.bzip.org>. +The primary site for the bzip2 program is L<https://sourceware.org/bzip2/>. See the module L<Compress::Bzip2|Compress::Bzip2> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Deflate.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Deflate.pm index 1ca86c9331..5ecac19b88 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Deflate.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Deflate.pm @@ -8,16 +8,16 @@ use bytes; require Exporter ; -use IO::Compress::RawDeflate 2.084 (); -use IO::Compress::Adapter::Deflate 2.084 ; +use IO::Compress::RawDeflate 2.093 (); +use IO::Compress::Adapter::Deflate 2.093 ; -use IO::Compress::Zlib::Constants 2.084 ; -use IO::Compress::Base::Common 2.084 qw(); +use IO::Compress::Zlib::Constants 2.093 ; +use IO::Compress::Base::Common 2.093 qw(); our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $DeflateError); -$VERSION = '2.084'; +$VERSION = '2.093'; $DeflateError = ''; @ISA = qw(IO::Compress::RawDeflate Exporter); @@ -212,7 +212,6 @@ IO::Compress::Deflate - Write RFC 1950 files/buffers binmode $z fileno $z close $z ; - =head1 DESCRIPTION @@ -239,7 +238,8 @@ The functional interface needs Perl5.005 or better. =head2 deflate $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<deflate> 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 @@ -252,7 +252,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. @@ -348,9 +348,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<deflate>, -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<deflate> +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 @@ -418,6 +418,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::Deflate=deflate -e 'deflate \*STDIN => \*STDOUT' >output.1950 + +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::Deflate=deflate -e 'deflate "-" => "-"' >output.1950 + +=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.1950>. @@ -429,6 +445,8 @@ data to the file C<file1.txt.1950>. deflate $input => "$input.1950" or die "deflate failed: $DeflateError\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>. @@ -443,6 +461,8 @@ compressed data to a buffer, C<$buffer>. deflate $input => \$buffer or die "deflate failed: $DeflateError\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 @@ -517,7 +537,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 @@ -892,6 +912,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::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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/FAQ.pod b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/FAQ.pod index 1e66507aa2..697f0f3d3b 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/FAQ.pod +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/FAQ.pod @@ -656,6 +656,12 @@ One final point -- obviously C<InputLength> can only be used whenever you know the length of the compressed data beforehand, like here with a zip file. +=head1 SUPPORT + +General feedback/questions/bug reports should be sent to +L<https://github.com/pmqs//issues> (preferred) or +L<https://rt.cpan.org/Public/Dist/Display.html?Name=>. + =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::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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Gzip.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Gzip.pm index 5302011a20..3fd1369508 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Gzip.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Gzip.pm @@ -8,12 +8,12 @@ use bytes; require Exporter ; -use IO::Compress::RawDeflate 2.084 () ; -use IO::Compress::Adapter::Deflate 2.084 ; +use IO::Compress::RawDeflate 2.093 () ; +use IO::Compress::Adapter::Deflate 2.093 ; -use IO::Compress::Base::Common 2.084 qw(:Status ); -use IO::Compress::Gzip::Constants 2.084 ; -use IO::Compress::Zlib::Extra 2.084 ; +use IO::Compress::Base::Common 2.093 qw(:Status ); +use IO::Compress::Gzip::Constants 2.093 ; +use IO::Compress::Zlib::Extra 2.093 ; BEGIN { @@ -25,7 +25,7 @@ BEGIN our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $GzipError); -$VERSION = '2.084'; +$VERSION = '2.093'; $GzipError = '' ; @ISA = qw(IO::Compress::RawDeflate Exporter); @@ -319,7 +319,6 @@ IO::Compress::Gzip - Write RFC 1952 files/buffers binmode $z fileno $z close $z ; - =head1 DESCRIPTION @@ -349,7 +348,8 @@ The functional interface needs Perl5.005 or better. =head2 gzip $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<gzip> 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 @@ -362,7 +362,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. @@ -466,9 +466,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<gzip>, -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<gzip> +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 @@ -536,6 +536,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::Gzip=gzip -e 'gzip \*STDIN => \*STDOUT' >output.gz + +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::Gzip=gzip -e 'gzip "-" => "-"' >output.gz + +=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.gz>. @@ -547,6 +563,8 @@ data to the file C<file1.txt.gz>. gzip $input => "$input.gz" or die "gzip failed: $GzipError\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>. @@ -561,6 +579,8 @@ compressed data to a buffer, C<$buffer>. gzip $input => \$buffer or die "gzip failed: $GzipError\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 @@ -635,7 +655,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 @@ -1204,6 +1224,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-Copress/issues> (preferred) or +L<https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Copress>. + =head1 SEE ALSO L<Compress::Zlib>, 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::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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Gzip/Constants.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Gzip/Constants.pm index d1bd0c2bb2..1d18fc4004 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Gzip/Constants.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Gzip/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names); our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE); -$VERSION = '2.084'; +$VERSION = '2.093'; @ISA = qw(Exporter); diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm index b2f38ff402..c833f5e98b 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm +++ b/systems/texlive/tlnet/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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zip.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zip.pm index eabeef63e7..70b98b80d6 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zip.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zip.pm @@ -4,30 +4,30 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.084 qw(:Status ); -use IO::Compress::RawDeflate 2.084 (); -use IO::Compress::Adapter::Deflate 2.084 ; -use IO::Compress::Adapter::Identity 2.084 ; -use IO::Compress::Zlib::Extra 2.084 ; -use IO::Compress::Zip::Constants 2.084 ; +use IO::Compress::Base::Common 2.093 qw(:Status ); +use IO::Compress::RawDeflate 2.093 (); +use IO::Compress::Adapter::Deflate 2.093 ; +use IO::Compress::Adapter::Identity 2.093 ; +use IO::Compress::Zlib::Extra 2.093 ; +use IO::Compress::Zip::Constants 2.093 ; use File::Spec(); use Config; -use Compress::Raw::Zlib 2.084 (); +use Compress::Raw::Zlib 2.093 (); BEGIN { eval { require IO::Compress::Adapter::Bzip2 ; - import IO::Compress::Adapter::Bzip2 2.084 ; + import IO::Compress::Adapter::Bzip2 2.093 ; require IO::Compress::Bzip2 ; - import IO::Compress::Bzip2 2.084 ; + import IO::Compress::Bzip2 2.093 ; } ; eval { require IO::Compress::Adapter::Lzma ; - import IO::Compress::Adapter::Lzma 2.084 ; + import IO::Compress::Adapter::Lzma 2.093 ; require IO::Compress::Lzma ; - import IO::Compress::Lzma 2.084 ; + import IO::Compress::Lzma 2.093 ; } ; } @@ -36,7 +36,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $ZipError); -$VERSION = '2.084'; +$VERSION = '2.093'; $ZipError = ''; @ISA = qw(IO::Compress::RawDeflate Exporter); @@ -246,13 +246,17 @@ sub mkHeader &{ *$self->{ZipData}{FilterName} }() ; } -# if ( $param->getValue('utf8') ) { -# require Encode ; -# $filename = Encode::encode_utf8($filename) -# if length $filename ; -# $comment = Encode::encode_utf8($comment) -# if length $comment ; -# } + if ( $param->getValue('efs') && $] >= 5.008004) { + if (length $filename) { + utf8::downgrade($filename, 1) + or Carp::croak "Wide character in zip filename"; + } + + if (length $comment) { + utf8::downgrade($comment, 1) + or Carp::croak "Wide character in zip comment"; + } + } my $hdr = ''; @@ -325,8 +329,8 @@ sub mkHeader $gpFlag |= ZIP_GP_FLAG_LZMA_EOS_PRESENT if $method == ZIP_CM_LZMA ; -# $gpFlag |= ZIP_GP_FLAG_LANGUAGE_ENCODING -# if $param->getValue('utf8') && (length($filename) || length($comment)); + $gpFlag |= ZIP_GP_FLAG_LANGUAGE_ENCODING + if $param->getValue('efs') && (length($filename) || length($comment)); my $version = $ZIP_CM_MIN_VERSIONS{$method}; $version = ZIP64_MIN_VERSION @@ -682,7 +686,7 @@ our %PARAMS = ( 'name' => [IO::Compress::Base::Common::Parse_any, ''], 'filtername'=> [IO::Compress::Base::Common::Parse_code, undef], 'canonicalname'=> [IO::Compress::Base::Common::Parse_boolean, 0], -# 'utf8' => [IO::Compress::Base::Common::Parse_boolean, 0], + 'efs' => [IO::Compress::Base::Common::Parse_boolean, 0], 'time' => [IO::Compress::Base::Common::Parse_any, undef], 'extime' => [IO::Compress::Base::Common::Parse_any, undef], 'exunix2' => [IO::Compress::Base::Common::Parse_any, undef], @@ -905,7 +909,6 @@ IO::Compress::Zip - Write zip files/buffers binmode $z fileno $z close $z ; - =head1 DESCRIPTION @@ -916,14 +919,18 @@ The primary purpose of this module is to provide streaming write access to zip files and buffers. It is not a general-purpose file archiver. If that is what you want, check out C<Archive::Zip> or C<Archive::Zip::SimpleZip>. -At present three compression methods are supported by IO::Compress::Zip, +At present the following compression methods are supported by IO::Compress::Zip, namely Store (no compression at all), Deflate, Bzip2 and LZMA. -Note that to create Bzip2 content, the module C<IO::Compress::Bzip2> must -be installed. +B<Note> + +=over 5 + +=item * To use Bzip2 compression, the module C<IO::Compress::Bzip2> must be installed. -Note that to create LZMA content, the module C<IO::Compress::Lzma> must -be installed. +=item * To use LZMA compression, the module C<IO::Compress::Lzma> must be installed. + +=back For reading zip files/buffers, see the companion module L<IO::Uncompress::Unzip|IO::Uncompress::Unzip>. @@ -945,7 +952,8 @@ The functional interface needs Perl5.005 or better. =head2 zip $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<zip> 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 @@ -958,7 +966,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. @@ -1062,9 +1070,9 @@ in C<$output_filename_or_reference> as a distinct entry. =head2 Optional Parameters -Unless specified below, the optional parameters for C<zip>, -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<zip> +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 @@ -1132,6 +1140,50 @@ 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::Zip=zip -e 'zip \*STDIN => \*STDOUT' >output.zip + +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::Zip=zip -e 'zip "-" => "-"' >output.zip + +One problem with creating a zip archive directly from STDIN can be demonstrated by looking at +the contents of the zip file, output.zip, that we have just created. + + $ unzip -l output.zip + Archive: output.zip + Length Date Time Name + --------- ---------- ----- ---- + 12 2019-08-16 22:21 + --------- ------- + 12 1 file + +The archive member (filename) used is the empty string. + +If that doesn't suit your needs, you can explicitly set the filename used +in the zip archive by specifying the L<Name|"File Naming Options"> option, like so + + echo hello world | perl -MIO::Compress::Zip=zip -e 'zip "-" => "-", Name => "hello.txt"' >output.zip + +Now the contents of the zip file looks like this + + $ unzip -l output.zip + Archive: output.zip + Length Date Time Name + --------- ---------- ----- ---- + 12 2019-08-16 22:22 hello.txt + --------- ------- + 12 1 file + +=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.zip>. @@ -1143,6 +1195,8 @@ data to the file C<file1.txt.zip>. zip $input => "$input.zip" or die "zip failed: $ZipError\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>. @@ -1157,6 +1211,8 @@ compressed data to a buffer, C<$buffer>. zip $input => \$buffer or die "zip failed: $ZipError\n"; +=head3 Compressing multiple files + To create a zip file, C<output.zip>, that contains the compressed contents of the files C<alpha.txt> and C<beta.txt> @@ -1235,7 +1291,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 @@ -1278,22 +1334,52 @@ to it. Otherwise the file pointer will not be moved. This parameter defaults to 0. +=back + +=head3 File Naming Options + +A quick bit of zip file terminology -- A zip archive consists of one or more I<archive members>, where each member has an associated +filename, known as the I<archive member name>. + +The options listed in this section control how the I<archive member name> (or filename) is stored the zip archive. + +=over 5 + =item C<< Name => $string >> -Stores the contents of C<$string> in the zip filename header field. +This option is used to explicitly set the I<archive member name> in +the zip archive to C<$string>. +Most of the time you don't need to make use of this option. +By default when adding a filename to the zip archive, the I<archive member name> will match the filename. + +You should only need to use this option if you want the I<archive member name> +to be different from the uncompressed filename or when the input is a filehandle or a buffer. -If C<Name> is not specified and the C<$input> parameter is a filename, the -value of C<$input> will be used for the zip filename header field. +The default behaviour for what I<archive member name> is used when the C<Name> option +is I<not> specified depends on the form of the C<$input> parameter: + +=over 5 -If C<Name> is not specified and the C<$input> parameter is not a filename, -no zip filename field will be created. +=item * + +If the C<$input> parameter is a filename, the +value of C<$input> will be used for the I<archive member name> . + +=item * +If the C<$input> parameter is not a filename, +the I<archive member name> will be an empty string. + +=back Note that both the C<CanonicalName> and C<FilterName> options -can modify the value used for the zip filename header field. +can modify the value used for the I<archive member name>. + +Also note that you should set the C<Efs> option to true if you are working +with UTF8 filenames. =item C<< CanonicalName => 0|1 >> -This option controls whether the filename field in the zip header is +This option controls whether the I<archive member name> is I<normalized> into Unix format before being written to the zip file. It is recommended that you enable this option unless you really need @@ -1313,15 +1399,14 @@ This option defaults to B<false>. =item C<< FilterName => sub { ... } >> -This option allow the filename field in the zip header to be modified +This option allow the I<archive member> name to be modified before it is written to the zip file. This option takes a parameter that must be a reference to a sub. On entry to the sub the C<$_> variable will contain the name to be filtered. If no filename is available C<$_> will contain an empty string. -The value of C<$_> when the sub returns will be stored in the filename -header field. +The value of C<$_> when the sub returns will be used as the I<archive member name>. Note that if C<CanonicalName> is enabled, a normalized filename will be passed to the sub. @@ -1343,6 +1428,167 @@ filenames before they are stored in C<$zipfile>. FilterName => sub { s[^$dir/][] } ; } +=item C<< Efs => 0|1 >> + +This option controls setting of the "Language Encoding Flag" (EFS) in the zip +archive. When set, the filename and comment fields for the zip archive MUST +be valid UTF-8. + +If the string used for the filename and/or comment is not valid UTF-8 when this option +is true, the script will die with a "wide character" error. + +Note that this option only works with Perl 5.8.4 or better. + +This option defaults to B<false>. + +=back + +=head3 Overall Zip Archive Structure + +=over 5 + +=item C<< Minimal => 1|0 >> + +If specified, this option will disable the creation of all extra fields +in the zip local and central headers. So the C<exTime>, C<exUnix2>, +C<exUnixN>, C<ExtraFieldLocal> and C<ExtraFieldCentral> options will +be ignored. + +This parameter defaults to 0. + +=item C<< Stream => 0|1 >> + +This option controls whether the zip file/buffer output is created in +streaming mode. + +Note that when outputting to a file with streaming mode disabled (C<Stream> +is 0), the output file must be seekable. + +The default is 1. + +=item C<< Zip64 => 0|1 >> + +Create a Zip64 zip file/buffer. This option is used if you want +to store files larger than 4 Gig or store more than 64K files in a single +zip archive. + +C<Zip64> will be automatically set, as needed, if working with the one-shot +interface when the input is either a filename or a scalar reference. + +If you intend to manipulate the Zip64 zip files created with this module +using an external zip/unzip, make sure that it supports Zip64. + +In particular, if you are using Info-Zip you need to have zip version 3.x +or better to update a Zip64 archive and unzip version 6.x to read a zip64 +archive. + +The default is 0. + +=back + +=head3 Deflate Compression Options + +=over 5 + +=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 +compression), or one of the symbolic constants defined below. + + Z_NO_COMPRESSION + Z_BEST_SPEED + Z_BEST_COMPRESSION + Z_DEFAULT_COMPRESSION + +The default is Z_DEFAULT_COMPRESSION. + +Note, these constants are not imported by C<IO::Compress::Zip> by default. + + use IO::Compress::Zip qw(:strategy); + use IO::Compress::Zip qw(:constants); + use IO::Compress::Zip qw(:all); + +=item -Strategy + +Defines the strategy used to tune the compression. Use one of the symbolic +constants defined below. + + Z_FILTERED + Z_HUFFMAN_ONLY + Z_RLE + Z_FIXED + Z_DEFAULT_STRATEGY + +The default is Z_DEFAULT_STRATEGY. + +=back + +=head3 Bzip2 Compression Options + +=over 5 + +=item C<< BlockSize100K => number >> + +Specify the number of 100K blocks bzip2 uses during compression. + +Valid values are from 1 to 9, where 9 is best compression. + +This option is only valid if the C<Method> is ZIP_CM_BZIP2. It is ignored +otherwise. + +The default is 1. + +=item C<< WorkFactor => number >> + +Specifies how much effort bzip2 should take before resorting to a slower +fallback compression algorithm. + +Valid values range from 0 to 250, where 0 means use the default value 30. + +This option is only valid if the C<Method> is ZIP_CM_BZIP2. It is ignored +otherwise. + +The default is 0. + +=back + +=head3 Lzma Compression Options + +=over 5 + +=item C<< Preset => number >> + +Used to choose the LZMA compression preset. + +Valid values are 0-9 and C<LZMA_PRESET_DEFAULT>. + +0 is the fastest compression with the lowest memory usage and the lowest +compression. + +9 is the slowest compression with the highest memory usage but with the best +compression. + +This option is only valid if the C<Method> is ZIP_CM_LZMA. It is ignored +otherwise. + +Defaults to C<LZMA_PRESET_DEFAULT> (6). + +=item C<< Extreme => 0|1 >> + +Makes LZMA compression a lot slower, but a small compression gain. + +This option is only valid if the C<Method> is ZIP_CM_LZMA. It is ignored +otherwise. + +Defaults to 0. + +=back + +=head3 Other Options + +=over 5 + =item C<< Time => $number >> Sets the last modified time field in the zip header to $number. @@ -1424,6 +1670,8 @@ By default no UnixN extra field is created. Stores the contents of C<$comment> in the Central File Header of the zip file. +Set the C<Efs> option to true if you want to store a UTF8 comment. + By default, no comment field is written to the zip file. =item C<< ZipComment => $comment >> @@ -1458,34 +1706,6 @@ content when C<IO::Compress::Lzma> is not available. The default method is ZIP_CM_DEFLATE. -=item C<< Stream => 0|1 >> - -This option controls whether the zip file/buffer output is created in -streaming mode. - -Note that when outputting to a file with streaming mode disabled (C<Stream> -is 0), the output file must be seekable. - -The default is 1. - -=item C<< Zip64 => 0|1 >> - -Create a Zip64 zip file/buffer. This option is used if you want -to store files larger than 4 Gig or store more than 64K files in a single -zip archive. - -C<Zip64> will be automatically set, as needed, if working with the one-shot -interface when the input is either a filename or a scalar reference. - -If you intend to manipulate the Zip64 zip files created with this module -using an external zip/unzip, make sure that it supports Zip64. - -In particular, if you are using Info-Zip you need to have zip version 3.x -or better to update a Zip64 archive and unzip version 6.x to read a zip64 -archive. - -The default is 0. - =item C<< TextFlag => 0|1 >> This parameter controls the setting of a bit in the zip central header. It @@ -1546,96 +1766,6 @@ If the C<Minimal> option is set to true, this option will be ignored. The maximum size of an extra field 65535 bytes. -=item C<< Minimal => 1|0 >> - -If specified, this option will disable the creation of all extra fields -in the zip local and central headers. So the C<exTime>, C<exUnix2>, -C<exUnixN>, C<ExtraFieldLocal> and C<ExtraFieldCentral> options will -be ignored. - -This parameter defaults to 0. - -=item C<< BlockSize100K => number >> - -Specify the number of 100K blocks bzip2 uses during compression. - -Valid values are from 1 to 9, where 9 is best compression. - -This option is only valid if the C<Method> is ZIP_CM_BZIP2. It is ignored -otherwise. - -The default is 1. - -=item C<< WorkFactor => number >> - -Specifies how much effort bzip2 should take before resorting to a slower -fallback compression algorithm. - -Valid values range from 0 to 250, where 0 means use the default value 30. - -This option is only valid if the C<Method> is ZIP_CM_BZIP2. It is ignored -otherwise. - -The default is 0. - -=item C<< Preset => number >> - -Used to choose the LZMA compression preset. - -Valid values are 0-9 and C<LZMA_PRESET_DEFAULT>. - -0 is the fastest compression with the lowest memory usage and the lowest -compression. - -9 is the slowest compression with the highest memory usage but with the best -compression. - -This option is only valid if the C<Method> is ZIP_CM_LZMA. It is ignored -otherwise. - -Defaults to C<LZMA_PRESET_DEFAULT> (6). - -=item C<< Extreme => 0|1 >> - -Makes LZMA compression a lot slower, but a small compression gain. - -This option is only valid if the C<Method> is ZIP_CM_LZMA. It is ignored -otherwise. - -Defaults to 0. - -=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 -compression), or one of the symbolic constants defined below. - - Z_NO_COMPRESSION - Z_BEST_SPEED - Z_BEST_COMPRESSION - Z_DEFAULT_COMPRESSION - -The default is Z_DEFAULT_COMPRESSION. - -Note, these constants are not imported by C<IO::Compress::Zip> by default. - - use IO::Compress::Zip qw(:strategy); - use IO::Compress::Zip qw(:constants); - use IO::Compress::Zip qw(:all); - -=item -Strategy - -Defines the strategy used to tune the compression. Use one of the symbolic -constants defined below. - - Z_FILTERED - Z_HUFFMAN_ONLY - Z_RLE - Z_FIXED - Z_DEFAULT_STRATEGY - -The default is Z_DEFAULT_STRATEGY. - =item C<< Strict => 0|1 >> This is a placeholder option. @@ -1918,6 +2048,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::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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zip/Constants.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zip/Constants.pm index d28a6ae686..edae0c29d2 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zip/Constants.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zip/Constants.pm @@ -7,7 +7,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS); -$VERSION = '2.084'; +$VERSION = '2.093'; @ISA = qw(Exporter); diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zlib/Constants.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zlib/Constants.pm index d0d053be95..c2fecba974 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zlib/Constants.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zlib/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT); -$VERSION = '2.084'; +$VERSION = '2.093'; @ISA = qw(Exporter); diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zlib/Extra.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zlib/Extra.pm index a88adba273..6e13d4fb2f 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zlib/Extra.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Compress/Zlib/Extra.pm @@ -8,9 +8,9 @@ use bytes; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = '2.084'; +$VERSION = '2.093'; -use IO::Compress::Gzip::Constants 2.084 ; +use IO::Compress::Gzip::Constants 2.093 ; sub ExtraFieldError { diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Dir.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Dir.pm index e381880b44..3a14ca8983 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Dir.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Dir.pm @@ -18,7 +18,7 @@ use File::stat; use File::Spec; our @ISA = qw(Tie::Hash Exporter); -our $VERSION = "1.40"; +our $VERSION = "1.41"; our @EXPORT_OK = qw(DIR_UNLINK); diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/File.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/File.pm index 137ba54029..cf51d9bf63 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/File.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/File.pm @@ -135,7 +135,7 @@ require Exporter; our @ISA = qw(IO::Handle IO::Seekable Exporter); -our $VERSION = "1.40"; +our $VERSION = "1.41"; our @EXPORT = @IO::Seekable::EXPORT; diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Handle.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Handle.pm index a257024645..45b6d4f520 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Handle.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Handle.pm @@ -270,7 +270,7 @@ use IO (); # Load the XS module require Exporter; our @ISA = qw(Exporter); -our $VERSION = "1.40"; +our $VERSION = "1.42"; our @EXPORT_OK = qw( autoflush @@ -431,26 +431,6 @@ sub say { print $this @_; } -# Special XS wrapper to make them inherit lexical hints from the caller. -_create_getline_subs( <<'END' ) or die $@; -sub getline { - @_ == 1 or croak 'usage: $io->getline()'; - my $this = shift; - return scalar <$this>; -} - -sub getlines { - @_ == 1 or croak 'usage: $io->getlines()'; - wantarray or - croak 'Can\'t call $io->getlines in a scalar context, use $io->getline'; - my $this = shift; - return <$this>; -} -1; # return true for error checking -END - -*gets = \&getline; # deprecated - sub truncate { @_ == 2 or croak 'usage: $io->truncate(LEN)'; truncate($_[0], $_[1]); diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Pipe.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Pipe.pm index e314c88d0e..c3ceb86233 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Pipe.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Pipe.pm @@ -13,7 +13,7 @@ use strict; use Carp; use Symbol; -our $VERSION = "1.40"; +our $VERSION = "1.41"; sub new { my $type = shift; diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Poll.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Poll.pm index 7aa1fb7514..3fe0179626 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Poll.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Poll.pm @@ -12,7 +12,7 @@ use IO::Handle; use Exporter (); our @ISA = qw(Exporter); -our $VERSION = "1.40"; +our $VERSION = "1.41"; our @EXPORT = qw( POLLIN POLLOUT diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Seekable.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Seekable.pm index 48f6dbeaf8..2370dcb89a 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Seekable.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Seekable.pm @@ -106,7 +106,7 @@ require Exporter; our @EXPORT = qw(SEEK_SET SEEK_CUR SEEK_END); our @ISA = qw(Exporter); -our $VERSION = "1.40"; +our $VERSION = "1.41"; sub seek { @_ == 3 or croak 'usage: $io->seek(POS, WHENCE)'; diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Select.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Select.pm index 7d68feb7ab..35a47ccbe0 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Select.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Select.pm @@ -10,7 +10,7 @@ use strict; use warnings::register; require Exporter; -our $VERSION = "1.40"; +our $VERSION = "1.42"; our @ISA = qw(Exporter); # This is only so we can do version checking @@ -57,7 +57,21 @@ sub _fileno my($self, $f) = @_; return unless defined $f; $f = $f->[0] if ref($f) eq 'ARRAY'; - ($f =~ /^\d+$/) ? $f : fileno($f); + if($f =~ /^[0-9]+$/) { # plain file number + return $f; + } + elsif(defined(my $fd = fileno($f))) { + return $fd; + } + else { + # Neither a plain file number nor an opened filehandle; but maybe it was + # previously registered and has since been closed. ->remove still wants to + # know what fileno it had + foreach my $i ( FIRST_FD .. $#$self ) { + return $i - FIRST_FD if $self->[$i] == $f; + } + return undef; + } } sub _update diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket.pm index 1bf57ab826..f10ac37532 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket.pm @@ -23,7 +23,7 @@ require IO::Socket::UNIX if ($^O ne 'epoc' && $^O ne 'symbian'); our @ISA = qw(IO::Handle); -our $VERSION = "1.40"; +our $VERSION = "1.43"; our @EXPORT_OK = qw(sockatmark); @@ -82,7 +82,12 @@ sub socket { ${*$sock}{'io_socket_domain'} = $domain; ${*$sock}{'io_socket_type'} = $type; - ${*$sock}{'io_socket_proto'} = $protocol; + + # "A value of 0 for protocol will let the system select an + # appropriate protocol" + # so we need to look up what the system selected, + # not cache PF_UNSPEC. + ${*$sock}{'io_socket_proto'} = $protocol if $protocol; $sock; } @@ -179,25 +184,25 @@ sub blocking { # # which is used to set blocking behaviour. - # NOTE: + # NOTE: # This is a little confusing, the perl keyword for this is # 'blocking' but the OS level behaviour is 'non-blocking', probably # because sockets are blocking by default. # Therefore internally we have to reverse the semantics. my $orig= !${*$sock}{io_sock_nonblocking}; - + return $orig unless @_; my $block = shift; - + if ( !$block != !$orig ) { ${*$sock}{io_sock_nonblocking} = $block ? 0 : 1; ioctl($sock, 0x8004667e, pack("L!",${*$sock}{io_sock_nonblocking})) or return undef; } - - return $orig; + + return $orig; } @@ -277,14 +282,24 @@ sub send { @_ >= 2 && @_ <= 4 or croak 'usage: $sock->send(BUF, [FLAGS, [TO]])'; my $sock = $_[0]; my $flags = $_[2] || 0; - my $peer = $_[3] || $sock->peername; + my $peer; - croak 'send: Cannot determine peer address' - unless(defined $peer); + if ($_[3]) { + # the caller explicitly requested a TO, so use it + # this is non-portable for "connected" UDP sockets + $peer = $_[3]; + } + elsif (!defined getpeername($sock)) { + # we're not connected, so we require a peer from somewhere + $peer = $sock->peername; + + croak 'send: Cannot determine peer address' + unless(defined $peer); + } - my $r = defined(getpeername($sock)) - ? send($sock, $_[1], $flags) - : send($sock, $_[1], $flags, $peer); + my $r = $peer + ? send($sock, $_[1], $flags, $peer) + : send($sock, $_[1], $flags); # remember who we send to, if it was successful ${*$sock}{'io_socket_peername'} = $peer @@ -386,185 +401,504 @@ IO::Socket - Object interface to socket communications =head1 SYNOPSIS - use IO::Socket; + use strict; + use warnings; + + use IO::Socket qw(AF_INET AF_UNIX); + + # create a new AF_INET socket + my $sock = IO::Socket->new(Domain => AF_INET); + # which is the same as + $sock = IO::Socket::INET->new(); + + # create a new AF_UNIX socket + $sock = IO::Socket->new(Domain => AF_UNIX); + # which is the same as + $sock = IO::Socket::UNIX->new(); =head1 DESCRIPTION -C<IO::Socket> provides an object interface to creating and using sockets. It -is built upon the L<IO::Handle> interface and inherits all the methods defined -by L<IO::Handle>. +C<IO::Socket> provides an object-oriented, L<IO::Handle>-based interface to +creating and using sockets via L<Socket>, which provides a near one-to-one +interface to the C socket library. -C<IO::Socket> only defines methods for those operations which are common to all -types of socket. Operations which are specified to a socket in a particular -domain have methods defined in sub classes of C<IO::Socket> +C<IO::Socket> is a base class that really only defines methods for those +operations which are common to all types of sockets. Operations which are +specific to a particular socket domain have methods defined in subclasses of +C<IO::Socket>. See L<IO::Socket::INET>, L<IO::Socket::UNIX>, and +L<IO::Socket::IP> for examples of such a subclass. C<IO::Socket> will export all functions (and constants) defined by L<Socket>. -=head1 CONSTRUCTOR +=head1 CONSTRUCTOR ARGUMENTS -=over 4 +Given that C<IO::Socket> doesn't have attributes in the traditional sense, the +following arguments, rather than attributes, can be passed into the +constructor. -=item new ( [ARGS] ) +Constructor arguments should be passed in C<< Key => 'Value' >> pairs. -Creates an C<IO::Socket>, which is a reference to a -newly created symbol (see the C<Symbol> package). C<new> -optionally takes arguments, these arguments are in key-value pairs. -C<new> only looks for one key C<Domain> which tells new which domain -the socket will be in. All other arguments will be passed to the -configuration method of the package for that domain, See below. +The only required argument is L<IO::Socket/"Domain">. -B<NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE> +=head2 Blocking -As of VERSION 1.18 all IO::Socket objects have autoflush turned on -by default. This was not the case with earlier releases. + my $sock = IO::Socket->new(..., Blocking => 1); + $sock = IO::Socket->new(..., Blocking => 0); -B<NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE> +If defined but false, the socket will be set to non-blocking mode. If not +specified it defaults to C<1> (blocking mode). -=back +=head2 Domain -=head1 METHODS + my $sock = IO::Socket->new(Domain => IO::Socket::AF_INET); + $sock = IO::Socket->new(Domain => IO::Socket::AF_UNIX); -See L<perlfunc> for complete descriptions of each of the following -supported C<IO::Socket> methods, which are just front ends for the -corresponding built-in functions: +The socket domain will define which subclass of C<IO::Socket> to use. The two +options available along with this distribution are C<AF_INET> and C<AF_UNIX>. - socket - socketpair - bind - listen - accept - send - recv - peername (getpeername) - sockname (getsockname) - shutdown +C<AF_INET> is for the internet address family of sockets and is handled via +L<IO::Socket::INET>. C<AF_INET> sockets are bound to an internet address and +port. -Some methods take slightly different arguments to those defined in L<perlfunc> -in attempt to make the interface more flexible. These are +C<AF_UNIX> is for the unix domain socket and is handled via +L<IO::Socket::UNIX>. C<AF_UNIX> sockets are bound to the file system as their +address name space. -=over 4 +This argument is B<required>. All other arguments are optional. -=item accept([PKG]) +=head2 Listen -perform the system call C<accept> on the socket and return a new -object. The new object will be created in the same class as the listen -socket, unless C<PKG> is specified. This object can be used to -communicate with the client that was trying to connect. + my $sock = IO::Socket->new(..., Listen => 5); -In a scalar context the new socket is returned, or undef upon -failure. In a list context a two-element array is returned containing -the new socket and the peer address; the list will be empty upon -failure. +Listen should be an integer value or left unset. + +If provided, this argument will place the socket into listening mode. New +connections can then be accepted using the L<IO::Socket/"accept"> method. The +value given is used as the C<listen(2)> queue size. + +If the C<Listen> argument is given, but false, the queue size will be set to +5. + +=head2 Timeout + + my $sock = IO::Socket->new(..., Timeout => 5); + +The timeout value, in seconds, for this socket connection. How exactly this +value is utilized is defined in the socket domain subclasses that make use of +the value. + +=head2 Type + + my $sock = IO::Socket->new(..., Type => IO::Socket::SOCK_STREAM); + +The socket type that will be used. These are usually C<SOCK_STREAM>, +C<SOCK_DGRAM>, or C<SOCK_RAW>. If this argument is left undefined an attempt +will be made to infer the type from the service name. + +For example, you'll usually use C<SOCK_STREAM> with a C<tcp> connection and +C<SOCK_DGRAM> with a C<udp> connection. + +=head1 CONSTRUCTORS + +C<IO::Socket> extends the L<IO::Handle> constructor. + +=head2 new + + my $sock = IO::Socket->new(); + + # get a new IO::Socket::INET instance + $sock = IO::Socket->new(Domain => IO::Socket::AF_INET); + # get a new IO::Socket::UNIX instance + $sock = IO::Socket->new(Domain => IO::Socket::AF_UNIX); -The timeout in the [PKG] can be specified as zero to effect a "poll", -but you shouldn't do that because a new IO::Select object will be -created behind the scenes just to do the single poll. This is -horrendously inefficient. Use rather true select() with a zero -timeout on the handle, or non-blocking IO. + # Domain is the only required argument + $sock = IO::Socket->new( + Domain => IO::Socket::AF_INET, # AF_INET, AF_UNIX + Type => IO::Socket::SOCK_STREAM, # SOCK_STREAM, SOCK_DGRAM, ... + Proto => 'tcp', # 'tcp', 'udp', IPPROTO_TCP, IPPROTO_UDP + # and so on... + ); -=item socketpair(DOMAIN, TYPE, PROTOCOL) +Creates an C<IO::Socket>, which is a reference to a newly created symbol (see +the L<Symbol> package). C<new> optionally takes arguments, these arguments +are defined in L<IO::Socket/"CONSTRUCTOR ARGUMENTS">. -Call C<socketpair> and return a list of two sockets created, or an -empty list on failure. +Any of the L<IO::Socket/"CONSTRUCTOR ARGUMENTS"> may be passed to the +constructor, but if any arguments are provided, then one of them must be +the L<IO::Socket/"Domain"> argument. The L<IO::Socket/"Domain"> argument can, +by default, be either C<AF_INET> or C<AF_UNIX>. Other domains can be used if a +proper subclass for the domain family is registered. All other arguments will +be passed to the C<configuration> method of the package for that domain. -=back +=head1 METHODS + +C<IO::Socket> inherits all methods from L<IO::Handle> and implements the +following new ones. -Additional methods that are provided are: +=head2 accept -=over 4 + my $client_sock = $sock->accept(); + my $inet_sock = $sock->accept('IO::Socket::INET'); -=item atmark +The accept method will perform the system call C<accept> on the socket and +return a new object. The new object will be created in the same class as the +listen socket, unless a specific package name is specified. This object can be +used to communicate with the client that was trying to connect. -True if the socket is currently positioned at the urgent data mark, -false otherwise. +This differs slightly from the C<accept> function in L<perlfunc>. + +In a scalar context the new socket is returned, or C<undef> upon +failure. In a list context a two-element array is returned containing +the new socket and the peer address; the list will be empty upon failure. - use IO::Socket; +=head2 atmark - my $sock = IO::Socket::INET->new('some_server'); + my $integer = $sock->atmark(); + # read in some data on a given socket + my $data; $sock->read($data, 1024) until $sock->atmark; -Note: this is a reasonably new addition to the family of socket -functions, so all systems may not support this yet. If it is -unsupported by the system, an attempt to use this method will -abort the program. + # or, export the function to use: + use IO::Socket 'sockatmark'; + $sock->read($data, 1024) until sockatmark($sock); -The atmark() functionality is also exportable as sockatmark() function: +True if the socket is currently positioned at the urgent data mark, false +otherwise. If your system doesn't yet implement C<sockatmark> this will throw +an exception. - use IO::Socket 'sockatmark'; +If your system does not support C<sockatmark>, the C<use> declaration will +fail at compile time. + +=head2 autoflush + + # by default, autoflush will be turned on when referenced + $sock->autoflush(); # turns on autoflush + # turn off autoflush + $sock->autoflush(0); + # turn on autoflush + $sock->autoflush(1); -This allows for a more traditional use of sockatmark() as a procedural -socket function. If your system does not support sockatmark(), the -C<use> declaration will fail at compile time. +This attribute isn't overridden from L<IO::Handle>'s implementation. However, +since we turn it on by default, it's worth mentioning here. -=item connected +=head2 bind + + use Socket qw(pack_sockaddr_in); + my $port = 3000; + my $ip_address = '0.0.0.0'; + my $packed_addr = pack_sockaddr_in($port, $ip_address); + $sock->bind($packed_addr); + +Binds a network address to a socket, just as C<bind(2)> does. Returns true if +it succeeded, false otherwise. You should provide a packed address of the +appropriate type for the socket. + +=head2 connected + + my $peer_addr = $sock->connected(); + if ($peer_addr) { + say "We're connected to $peer_addr"; + } If the socket is in a connected state, the peer address is returned. If the -socket is not in a connected state, undef is returned. +socket is not in a connected state, C<undef> is returned. -Note that connected() considers a half-open TCP socket to be "in a connected -state". Specifically, connected() does not distinguish between the +Note that this method considers a half-open TCP socket to be "in a connected +state". Specifically, it does not distinguish between the B<ESTABLISHED> and B<CLOSE-WAIT> TCP states; it returns the peer address, -rather than undef, in either case. Thus, in general, connected() cannot +rather than C<undef>, in either case. Thus, in general, it cannot be used to reliably learn whether the peer has initiated a graceful shutdown because in most cases (see below) the local TCP state machine remains in -B<CLOSE-WAIT> until the local application calls shutdown() or close(); -only at that point does connected() return undef. +B<CLOSE-WAIT> until the local application calls L<IO::Socket/"shutdown"> or +C<close>. Only at that point does this function return C<undef>. The "in most cases" hedge is because local TCP state machine behavior may depend on the peer's socket options. In particular, if the peer socket has -SO_LINGER enabled with a zero timeout, then the peer's close() will generate -a RST segment, upon receipt of which the local TCP transitions immediately to -B<CLOSED>, and in that state, connected() I<will> return undef. +C<SO_LINGER> enabled with a zero timeout, then the peer's C<close> will +generate a C<RST> segment. Upon receipt of that segment, the local TCP +transitions immediately to B<CLOSED>, and in that state, this method I<will> +return C<undef>. + +=head2 getsockopt -=item protocol + my $value = $sock->getsockopt(SOL_SOCKET, SO_REUSEADDR); + my $buf = $socket->getsockopt(SOL_SOCKET, SO_RCVBUF); + say "Receive buffer is $buf bytes"; -Returns the numerical number for the protocol being used on the socket, if -known. If the protocol is unknown, as with an AF_UNIX socket, zero +Get an option associated with the socket. Levels other than C<SOL_SOCKET> +may be specified here. As a convenience, this method will unpack a byte buffer +of the correct size back into a number. + +=head2 listen + + $sock->listen(5); + +Does the same thing that the C<listen(2)> system call does. Returns true if it +succeeded, false otherwise. Listens to a socket with a given queue size. + +=head2 peername + + my $sockaddr_in = $sock->peername(); + +Returns the packed C<sockaddr> address of the other end of the socket +connection. It calls C<getpeername>. + + +=head2 protocol + + my $proto = $sock->protocol(); + +Returns the number for the protocol being used on the socket, if +known. If the protocol is unknown, as with an C<AF_UNIX> socket, zero is returned. -=item sockdomain +=head2 recv + + my $buffer = ""; + my $length = 1024; + my $flags = 0; # default. optional + $sock->recv($buffer, $length); + $sock->recv($buffer, $length, $flags); + +Similar in functionality to L<perlfunc/recv>. + +Receives a message on a socket. Attempts to receive C<$length> characters of +data into C<$buffer> from the specified socket. C<$buffer> will be grown or +shrunk to the length actually read. Takes the same flags as the system call of +the same name. Returns the address of the sender if socket's protocol supports +this; returns an empty string otherwise. If there's an error, returns +C<undef>. This call is actually implemented in terms of the C<recvfrom(2)> +system call. -Returns the numerical number for the socket domain type. For example, for -an AF_INET socket the value of &AF_INET will be returned. +Flags are ORed together values, such as C<MSG_BCAST>, C<MSG_OOB>, +C<MSG_TRUNC>. The default value for the flags is C<0>. -=item sockopt(OPT [, VAL]) +The cached value of L<IO::Socket/"peername"> is updated with the result of +C<recv>. -Unified method to both set and get options in the SOL_SOCKET level. If called -with one argument then getsockopt is called, otherwise setsockopt is called. +B<Note:> In Perl v5.30 and newer, if the socket has been marked as C<:utf8>, +C<recv> will throw an exception. The C<:encoding(...)> layer implicitly +introduces the C<:utf8> layer. See L<perlfunc/binmode>. -=item getsockopt(LEVEL, OPT) +B<Note:> In Perl versions older than v5.30, depending on the status of the +socket, either (8-bit) bytes or characters are received. By default all +sockets operate on bytes, but for example if the socket has been changed +using L<perlfunc/binmode> to operate with the C<:encoding(UTF-8)> I/O layer +(see the L<perlfunc/open> pragma), the I/O will operate on UTF8-encoded +Unicode characters, not bytes. Similarly for the C<:encoding> layer: in +that case pretty much any characters can be read. -Get option associated with the socket. Other levels than SOL_SOCKET -may be specified here. +=head2 send -=item setsockopt(LEVEL, OPT, VAL) + my $message = "Hello, world!"; + my $flags = 0; # defaults to zero + my $to = '0.0.0.0'; # optional destination + my $sent = $sock->send($message); + $sent = $sock->send($message, $flags); + $sent = $sock->send($message, $flags, $to); -Set option associated with the socket. Other levels than SOL_SOCKET -may be specified here. +Similar in functionality to L<perlfunc/send>. -=item socktype +Sends a message on a socket. Attempts to send the scalar message to the +socket. Takes the same flags as the system call of the same name. On +unconnected sockets, you must specify a destination to send to, in which case +it does a C<sendto(2)> syscall. Returns the number of characters sent, or +C<undef> on error. The C<sendmsg(2)> syscall is currently unimplemented. -Returns the numerical number for the socket type. For example, for -a SOCK_STREAM socket the value of &SOCK_STREAM will be returned. +The C<flags> option is optional and defaults to C<0>. -=item timeout([VAL]) +After a successful send with C<$to>, further calls to C<send> on an +unconnected socket without C<$to> will send to the same address, and C<$to> +will be used as the result of L<IO::Socket/"peername">. + +B<Note:> In Perl v5.30 and newer, if the socket has been marked as C<:utf8>, +C<send> will throw an exception. The C<:encoding(...)> layer implicitly +introduces the C<:utf8> layer. See L<perlfunc/binmode>. + +B<Note:> In Perl versions older than v5.30, depending on the status of the +socket, either (8-bit) bytes or characters are sent. By default all +sockets operate on bytes, but for example if the socket has been changed +using L<perlfunc/binmode> to operate with the C<:encoding(UTF-8)> I/O layer +(see the L<perlfunc/open> pragma), the I/O will operate on UTF8-encoded +Unicode characters, not bytes. Similarly for the C<:encoding> layer: in +that case pretty much any characters can be sent. + +=head2 setsockopt + + $sock->setsockopt(SOL_SOCKET, SO_REUSEADDR, 1); + $sock->setsockopt(SOL_SOCKET, SO_RCVBUF, 64*1024); + +Set option associated with the socket. Levels other than C<SOL_SOCKET> +may be specified here. As a convenience, this method will convert a number +into a packed byte buffer. + +=head2 shutdown + + $sock->shutdown(SHUT_RD); # we stopped reading data + $sock->shutdown(SHUT_WR); # we stopped writing data + $sock->shutdown(SHUT_RDWR); # we stopped using this socket + +Shuts down a socket connection in the manner indicated by the value passed in, +which has the same interpretation as in the syscall of the same name. + +This is useful with sockets when you want to tell the other side you're done +writing but not done reading, or vice versa. It's also a more insistent form +of C<close> because it also disables the file descriptor in any +forked copies in other processes. + +Returns C<1> for success; on error, returns C<undef> if the socket is +not a valid filehandle, or returns C<0> and sets C<$!> for any other failure. + +=head2 sockdomain + + my $domain = $sock->sockdomain(); + +Returns the number for the socket domain type. For example, for +an C<AF_INET> socket the value of C<&AF_INET> will be returned. + +=head2 socket + + my $sock = IO::Socket->new(); # no values given + # now let's actually get a socket with the socket method + # domain, type, and protocol are required + $sock = $sock->socket(AF_INET, SOCK_STREAM, 'tcp'); + +Opens a socket of the specified kind and returns it. Domain, type, and +protocol are specified the same as for the syscall of the same name. + +=head2 socketpair + + my ($r, $w) = $sock->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC); + ($r, $w) = IO::Socket::UNIX + ->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC); + +Will return a list of two sockets created (read and write), or an empty list +on failure. + +Differs slightly from C<socketpair> in L<perlfunc> in that the argument list +is a bit simpler. + +=head2 sockname + + my $packed_addr = $sock->sockname(); + +Returns the packed C<sockaddr> address of this end of the connection. It's the +same as C<getsockname(2)>. + +=head2 sockopt + + my $value = $sock->sockopt(SO_REUSEADDR); + $sock->sockopt(SO_REUSEADDR, 1); + +Unified method to both set and get options in the C<SOL_SOCKET> level. If +called with one argument then L<IO::Socket/"getsockopt"> is called, otherwise +L<IO::Socket/"setsockopt"> is called. + +=head2 socktype + + my $type = $sock->socktype(); + +Returns the number for the socket type. For example, for +a C<SOCK_STREAM> socket the value of C<&SOCK_STREAM> will be returned. + +=head2 timeout + + my $seconds = $sock->timeout(); + my $old_val = $sock->timeout(5); # set new and return old value Set or get the timeout value (in seconds) associated with this socket. If called without any arguments then the current setting is returned. If called with an argument the current setting is changed and the previous value returned. -=back +This method is available to all C<IO::Socket> implementations but may or may +not be used by the individual domain subclasses. + +=head1 EXAMPLES + +Let's create a TCP server on C<localhost:3333>. + + use strict; + use warnings; + use feature 'say'; + + use IO::Socket qw(AF_INET AF_UNIX SOCK_STREAM SHUT_WR); + + my $server = IO::Socket->new( + Domain => AF_INET, + Type => SOCK_STREAM, + Proto => 'tcp', + LocalHost => '0.0.0.0', + LocalPort => 3333, + ReusePort => 1, + Listen => 5, + ) || die "Can't open socket: $@"; + say "Waiting on 3333"; + + while (1) { + # waiting for a new client connection + my $client = $server->accept(); + + # get information about a newly connected client + my $client_address = $client->peerhost(); + my $client_port = $client->peerport(); + say "Connection from $client_address:$client_port"; + + # read up to 1024 characters from the connected client + my $data = ""; + $client->recv($data, 1024); + say "received data: $data"; + + # write response data to the connected client + $data = "ok"; + $client->send($data); + + # notify client that response has been sent + $client->shutdown(SHUT_WR); + } + + $server->close(); + +A client for such a server could be + + use strict; + use warnings; + use feature 'say'; + + use IO::Socket qw(AF_INET AF_UNIX SOCK_STREAM SHUT_WR); + + my $client = IO::Socket->new( + Domain => AF_INET, + Type => SOCK_STREAM, + proto => 'tcp', + PeerPort => 3333, + PeerHost => '0.0.0.0', + ) || die "Can't open socket: $@"; + + say "Sending Hello World!"; + my $size = $client->send("Hello World!"); + say "Sent data of length: $size"; + + $client->shutdown(SHUT_WR); + + my $buffer; + $client->recv($buffer, 1024); + say "Got back $buffer"; + + $client->close(); + =head1 LIMITATIONS -On some systems, for an IO::Socket object created with new_from_fd(), -or created with accept() from such an object, the protocol(), -sockdomain() and socktype() methods may return undef. +On some systems, for an IO::Socket object created with C<new_from_fd>, +or created with L<IO::Socket/"accept"> from such an object, the +L<IO::Socket/"protocol">, L<IO::Socket/"sockdomain"> and +L<IO::Socket/"socktype"> methods may return C<undef>. =head1 SEE ALSO -L<Socket>, L<IO::Handle>, L<IO::Socket::INET>, L<IO::Socket::UNIX> +L<Socket>, L<IO::Handle>, L<IO::Socket::INET>, L<IO::Socket::UNIX>, +L<IO::Socket::IP> =head1 AUTHOR diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket/INET.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket/INET.pm index 8b4373f261..8688f375b5 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket/INET.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket/INET.pm @@ -14,7 +14,7 @@ use Exporter; use Errno; our @ISA = qw(IO::Socket); -our $VERSION = "1.40"; +our $VERSION = "1.41"; my $EINVAL = exists(&Errno::EINVAL) ? Errno::EINVAL() : 1; diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket/UNIX.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket/UNIX.pm index ff38af0f63..04b36eaf74 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket/UNIX.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Socket/UNIX.pm @@ -11,7 +11,7 @@ use IO::Socket; use Carp; our @ISA = qw(IO::Socket); -our $VERSION = "1.40"; +our $VERSION = "1.41"; IO::Socket::UNIX->register_domain( AF_UNIX ); diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm index 1aa9a8c39b..3fc176e500 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.084 qw(:Status); +use IO::Compress::Base::Common 2.093 qw(:Status); -use Compress::Raw::Bzip2 2.084 ; +use Compress::Raw::Bzip2 2.093 ; our ($VERSION, @ISA); -$VERSION = '2.084'; +$VERSION = '2.093'; sub mkUncompObject { diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm index 5601599225..c8622a5913 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm @@ -4,14 +4,14 @@ use warnings; use strict; use bytes; -use IO::Compress::Base::Common 2.084 qw(:Status); +use IO::Compress::Base::Common 2.093 qw(:Status); use IO::Compress::Zip::Constants ; our ($VERSION); -$VERSION = '2.084'; +$VERSION = '2.093'; -use Compress::Raw::Zlib 2.084 (); +use Compress::Raw::Zlib 2.093 (); sub mkUncompObject { @@ -139,7 +139,7 @@ sub reset { my $self = shift; - $self->{CompSize} = 0; + $self->{CompSize}->reset(); $self->{UnCompSize} = 0; $self->{CRC32} = Compress::Raw::Zlib::crc32(''); $self->{ADLER32} = Compress::Raw::Zlib::adler32(''); diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm index f51c64d7e5..a27af5ba8e 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm @@ -4,11 +4,11 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.084 qw(:Status); -use Compress::Raw::Zlib 2.084 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); +use IO::Compress::Base::Common 2.093 qw(:Status); +use Compress::Raw::Zlib 2.093 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); our ($VERSION); -$VERSION = '2.084'; +$VERSION = '2.093'; diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm index be464889eb..6172737e26 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm @@ -6,22 +6,22 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.084 (); +use IO::Compress::Base::Common 2.093 (); -use IO::Uncompress::Adapter::Inflate 2.084 (); +use IO::Uncompress::Adapter::Inflate 2.093 (); -use IO::Uncompress::Base 2.084 ; -use IO::Uncompress::Gunzip 2.084 ; -use IO::Uncompress::Inflate 2.084 ; -use IO::Uncompress::RawInflate 2.084 ; -use IO::Uncompress::Unzip 2.084 ; +use IO::Uncompress::Base 2.093 ; +use IO::Uncompress::Gunzip 2.093 ; +use IO::Uncompress::Inflate 2.093 ; +use IO::Uncompress::RawInflate 2.093 ; +use IO::Uncompress::Unzip 2.093 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError); -$VERSION = '2.084'; +$VERSION = '2.093'; $AnyInflateError = ''; @ISA = qw(IO::Uncompress::Base Exporter); @@ -48,7 +48,7 @@ sub anyinflate sub getExtraParams { - use IO::Compress::Base::Common 2.084 qw(:Parse); + use IO::Compress::Base::Common 2.093 qw(:Parse); return ( 'rawinflate' => [Parse_boolean, 0] ) ; } @@ -213,7 +213,8 @@ The functional interface needs Perl5.005 or better. =head2 anyinflate $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<anyinflate> 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 @@ -226,7 +227,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. @@ -323,9 +324,9 @@ files/buffers. =head2 Optional Parameters -Unless specified below, the optional parameters for C<anyinflate>, -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<anyinflate> +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 @@ -959,6 +960,12 @@ Same as doing this 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::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::AnyUncompress> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm index c6dfce536b..251b7cf263 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm @@ -4,16 +4,16 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.084 (); +use IO::Compress::Base::Common 2.093 (); -use IO::Uncompress::Base 2.084 ; +use IO::Uncompress::Base 2.093 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError); -$VERSION = '2.084'; +$VERSION = '2.093'; $AnyUncompressError = ''; @ISA = qw(IO::Uncompress::Base Exporter); @@ -29,26 +29,30 @@ BEGIN { local @INC = @INC; pop @INC if $INC[-1] eq '.'; - eval ' use IO::Uncompress::Adapter::Inflate 2.084 ;'; - eval ' use IO::Uncompress::Adapter::Bunzip2 2.084 ;'; - eval ' use IO::Uncompress::Adapter::LZO 2.084 ;'; - eval ' use IO::Uncompress::Adapter::Lzf 2.084 ;'; - eval ' use IO::Uncompress::Adapter::UnLzma 2.084 ;'; - eval ' use IO::Uncompress::Adapter::UnXz 2.084 ;'; + + # Don't trigger any __DIE__ Hooks. + local $SIG{__DIE__}; + + eval ' use IO::Uncompress::Adapter::Inflate 2.093 ;'; + eval ' use IO::Uncompress::Adapter::Bunzip2 2.093 ;'; + eval ' use IO::Uncompress::Adapter::LZO 2.093 ;'; + eval ' use IO::Uncompress::Adapter::Lzf 2.093 ;'; + eval ' use IO::Uncompress::Adapter::UnLzma 2.093 ;'; + eval ' use IO::Uncompress::Adapter::UnXz 2.093 ;'; eval ' use IO::Uncompress::Adapter::UnZstd 2.083 ;'; - eval ' use IO::Uncompress::Adapter::UnLzip 2.084 ;'; - - eval ' use IO::Uncompress::Bunzip2 2.084 ;'; - eval ' use IO::Uncompress::UnLzop 2.084 ;'; - eval ' use IO::Uncompress::Gunzip 2.084 ;'; - eval ' use IO::Uncompress::Inflate 2.084 ;'; - eval ' use IO::Uncompress::RawInflate 2.084 ;'; - eval ' use IO::Uncompress::Unzip 2.084 ;'; - eval ' use IO::Uncompress::UnLzf 2.084 ;'; - eval ' use IO::Uncompress::UnLzma 2.084 ;'; - eval ' use IO::Uncompress::UnXz 2.084 ;'; - eval ' use IO::Uncompress::UnZstd 2.084 ;'; - eval ' use IO::Uncompress::UnLzip 2.084 ;'; + eval ' use IO::Uncompress::Adapter::UnLzip 2.093 ;'; + + eval ' use IO::Uncompress::Bunzip2 2.093 ;'; + eval ' use IO::Uncompress::UnLzop 2.093 ;'; + eval ' use IO::Uncompress::Gunzip 2.093 ;'; + eval ' use IO::Uncompress::Inflate 2.093 ;'; + eval ' use IO::Uncompress::RawInflate 2.093 ;'; + eval ' use IO::Uncompress::Unzip 2.093 ;'; + eval ' use IO::Uncompress::UnLzf 2.093 ;'; + eval ' use IO::Uncompress::UnLzma 2.093 ;'; + eval ' use IO::Uncompress::UnXz 2.093 ;'; + eval ' use IO::Uncompress::UnZstd 2.093 ;'; + eval ' use IO::Uncompress::UnLzip 2.093 ;'; } @@ -266,7 +270,7 @@ __END__ =head1 NAME -IO::Uncompress::AnyUncompress - Uncompress gzip, zip, bzip2 or lzop file/buffer +IO::Uncompress::AnyUncompress - Uncompress gzip, zip, bzip2, xz, lzma, lzip, lzf or lzop file/buffer =head1 SYNOPSIS @@ -363,7 +367,8 @@ The functional interface needs Perl5.005 or better. =head2 anyuncompress $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<anyuncompress> 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 @@ -376,7 +381,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. @@ -473,9 +478,9 @@ files/buffers. =head2 Optional Parameters -Unless specified below, the optional parameters for C<anyuncompress>, -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<anyuncompress> +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 @@ -1044,6 +1049,12 @@ Same as doing this =head1 EXAMPLES +=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::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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Base.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Base.pm index 06fb04a81c..b9901ca1ff 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Base.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Base.pm @@ -9,12 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(IO::File Exporter); -$VERSION = '2.084'; +$VERSION = '2.093'; use constant G_EOF => 0 ; use constant G_ERR => -1 ; -use IO::Compress::Base::Common 2.084 ; +use IO::Compress::Base::Common 2.093 ; use IO::File ; use Symbol; @@ -1010,6 +1010,9 @@ sub nextStream $status == 1 or return $status ; + *$self->{Pending} = '' + if $self !~ /IO::Uncompress::RawInflate/ && ! *$self->{MultiStream}; + *$self->{TotalInflatedBytesRead} = 0 ; *$self->{LineNo} = $. = 0; @@ -1050,6 +1053,10 @@ sub gotoNextStream return 0; } + # Not EOF, so Transparent mode kicks in now for trailing data + # Reset member name in case anyone calls getHeaderInfo()->{Name} + *$self->{Info} = { Name => undef, Type => 'plain' }; + $self->clearError(); *$self->{Type} = 'plain'; *$self->{Plain} = 1; @@ -1527,6 +1534,12 @@ IO::Uncompress::Base - Base Class for IO::Uncompress modules This module is not intended for direct use in application code. Its sole purpose is to be sub-classed by IO::Uncompress modules. +=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::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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm index 7a84bcd15c..8e805d4c9e 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm @@ -4,15 +4,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.084 qw(:Status ); +use IO::Compress::Base::Common 2.093 qw(:Status ); -use IO::Uncompress::Base 2.084 ; -use IO::Uncompress::Adapter::Bunzip2 2.084 ; +use IO::Uncompress::Base 2.093 ; +use IO::Uncompress::Adapter::Bunzip2 2.093 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error); -$VERSION = '2.084'; +$VERSION = '2.093'; $Bunzip2Error = ''; @ISA = qw(IO::Uncompress::Base Exporter); @@ -209,7 +209,8 @@ The functional interface needs Perl5.005 or better. =head2 bunzip2 $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<bunzip2> 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 @@ -222,7 +223,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. @@ -319,9 +320,9 @@ files/buffers. =head2 Optional Parameters -Unless specified below, the optional parameters for C<bunzip2>, -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<bunzip2> +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 @@ -876,6 +877,12 @@ Same as doing this 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::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::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> @@ -886,7 +893,7 @@ L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>, L<Archive::Tar|Archive::Tar>, L<IO::Zlib|IO::Zlib> -The primary site for the bzip2 program is L<http://www.bzip.org>. +The primary site for the bzip2 program is L<https://sourceware.org/bzip2/>. See the module L<Compress::Bzip2|Compress::Bzip2> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm index 46dd108341..6e57e96118 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm @@ -9,12 +9,12 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.084 ; +use IO::Uncompress::RawInflate 2.093 ; -use Compress::Raw::Zlib 2.084 () ; -use IO::Compress::Base::Common 2.084 qw(:Status ); -use IO::Compress::Gzip::Constants 2.084 ; -use IO::Compress::Zlib::Extra 2.084 ; +use Compress::Raw::Zlib 2.093 () ; +use IO::Compress::Base::Common 2.093 qw(:Status ); +use IO::Compress::Gzip::Constants 2.093 ; +use IO::Compress::Zlib::Extra 2.093 ; require Exporter ; @@ -28,7 +28,7 @@ Exporter::export_ok_tags('all'); $GunzipError = ''; -$VERSION = '2.084'; +$VERSION = '2.093'; sub new { @@ -348,7 +348,8 @@ The functional interface needs Perl5.005 or better. =head2 gunzip $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<gunzip> 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 @@ -361,7 +362,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. @@ -458,9 +459,9 @@ files/buffers. =head2 Optional Parameters -Unless specified below, the optional parameters for C<gunzip>, -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<gunzip> +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 @@ -1082,6 +1083,12 @@ Same as doing this 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::Compress::Deflate>, 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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm index 4d89db5b19..993a1dddc8 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm @@ -5,15 +5,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.084 qw(:Status ); -use IO::Compress::Zlib::Constants 2.084 ; +use IO::Compress::Base::Common 2.093 qw(:Status ); +use IO::Compress::Zlib::Constants 2.093 ; -use IO::Uncompress::RawInflate 2.084 ; +use IO::Uncompress::RawInflate 2.093 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError); -$VERSION = '2.084'; +$VERSION = '2.093'; $InflateError = ''; @ISA = qw(IO::Uncompress::RawInflate Exporter); @@ -270,7 +270,8 @@ The functional interface needs Perl5.005 or better. =head2 inflate $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<inflate> 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 @@ -283,7 +284,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. @@ -380,9 +381,9 @@ files/buffers. =head2 Optional Parameters -Unless specified below, the optional parameters for C<inflate>, -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<inflate> +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 @@ -954,6 +955,12 @@ Same as doing this 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::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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm index 63703cd975..2fa318816a 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm @@ -5,16 +5,16 @@ use strict ; use warnings; use bytes; -use Compress::Raw::Zlib 2.084 ; -use IO::Compress::Base::Common 2.084 qw(:Status ); +use Compress::Raw::Zlib 2.093 ; +use IO::Compress::Base::Common 2.093 qw(:Status ); -use IO::Uncompress::Base 2.084 ; -use IO::Uncompress::Adapter::Inflate 2.084 ; +use IO::Uncompress::Base 2.093 ; +use IO::Uncompress::Adapter::Inflate 2.093 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError); -$VERSION = '2.084'; +$VERSION = '2.093'; $RawInflateError = ''; @ISA = qw(IO::Uncompress::Base Exporter); @@ -418,7 +418,8 @@ The functional interface needs Perl5.005 or better. =head2 rawinflate $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<rawinflate> 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 @@ -431,7 +432,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. @@ -528,9 +529,9 @@ files/buffers. =head2 Optional Parameters -Unless specified below, the optional parameters for C<rawinflate>, -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<rawinflate> +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 @@ -1082,6 +1083,12 @@ Same as doing this 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::Compress::RawDeflate>, 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> diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm index 4e8a0d67c7..856487f8fc 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm @@ -9,17 +9,20 @@ use warnings; use bytes; use IO::File; -use IO::Uncompress::RawInflate 2.084 ; -use IO::Compress::Base::Common 2.084 qw(:Status ); -use IO::Uncompress::Adapter::Inflate 2.084 ; -use IO::Uncompress::Adapter::Identity 2.084 ; -use IO::Compress::Zlib::Extra 2.084 ; -use IO::Compress::Zip::Constants 2.084 ; +use IO::Uncompress::RawInflate 2.093 ; +use IO::Compress::Base::Common 2.093 qw(:Status ); +use IO::Uncompress::Adapter::Inflate 2.093 ; +use IO::Uncompress::Adapter::Identity 2.093 ; +use IO::Compress::Zlib::Extra 2.093 ; +use IO::Compress::Zip::Constants 2.093 ; -use Compress::Raw::Zlib 2.084 () ; +use Compress::Raw::Zlib 2.093 () ; BEGIN { + # Don't trigger any __DIE__ Hooks. + local $SIG{__DIE__}; + eval{ require IO::Uncompress::Adapter::Bunzip2 ; import IO::Uncompress::Adapter::Bunzip2 } ; eval{ require IO::Uncompress::Adapter::UnLzma ; @@ -31,7 +34,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup); -$VERSION = '2.084'; +$VERSION = '2.093'; $UnzipError = ''; @ISA = qw(IO::Uncompress::RawInflate Exporter); @@ -70,6 +73,7 @@ sub getExtraParams 'name' => [IO::Compress::Base::Common::Parse_any, undef], 'stream' => [IO::Compress::Base::Common::Parse_boolean, 0], + 'efs' => [IO::Compress::Base::Common::Parse_boolean, 0], # TODO - This means reading the central directory to get # 1. the local header offsets @@ -86,6 +90,7 @@ sub ckParams $got->setValue('crc32' => 1); *$self->{UnzipData}{Name} = $got->getValue('name'); + *$self->{UnzipData}{efs} = $got->getValue('efs'); return 1; } @@ -551,6 +556,7 @@ sub _readZipHeader($) my $extraField; my @EXTRA = (); my $streamingMode = ($gpFlag & ZIP_GP_FLAG_STREAMING_MASK) ? 1 : 0 ; + my $efs_flag = ($gpFlag & ZIP_GP_FLAG_LANGUAGE_ENCODING) ? 1 : 0; return $self->HeaderError("Encrypted content not supported") if $gpFlag & (ZIP_GP_FLAG_ENCRYPTED_MASK|ZIP_GP_FLAG_STRONG_ENCRYPTED_MASK); @@ -565,6 +571,14 @@ sub _readZipHeader($) { $self->smartReadExact(\$filename, $filename_length) or return $self->TruncatedHeader("Filename"); + + if (*$self->{UnzipData}{efs} && $efs_flag && $] >= 5.008004) + { + require Encode; + eval { $filename = Encode::decode_utf8($filename, 1) } + or Carp::croak "Zip Filename not UTF-8" ; + } + $keep .= $filename ; } @@ -705,6 +719,7 @@ sub _readZipHeader($) 'UncompressedLength' => $uncompressedLength , 'CRC32' => $crc32 , 'Name' => $filename, + 'efs' => $efs_flag, # language encoding flag 'Time' => _dosToUnixTime($lastModTime), 'Stream' => $streamingMode, @@ -1107,7 +1122,8 @@ The functional interface needs Perl5.005 or better. =head2 unzip $input_filename_or_reference => $output_filename_or_reference [, OPTS] C<unzip> 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 @@ -1120,7 +1136,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. @@ -1217,9 +1233,9 @@ files/buffers. =head2 Optional Parameters -Unless specified below, the optional parameters for C<unzip>, -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<unzip> +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 @@ -1431,6 +1447,18 @@ OPTS is a combination of the following options: Open "membername" from the zip file for reading. +=item C<< Efs => 0| 1 >> + +When this option is set to true AND the zip archive being read has +the "Language Encoding Flag" (EFS) set, the member name is assumed to be encoded in UTF-8. + +If the member name in the zip archive is not valid UTF-8 when this optionn is true, +the script will die with an error message. + +Note that this option only works with Perl 5.8.4 or better. + +This option defaults to B<false>. + =item C<< AutoClose => 0|1 >> This option is only valid when the C<$input> parameter is a filehandle. If @@ -1731,6 +1759,10 @@ Skips to the next compressed data stream in the input file/buffer. If a new compressed data stream is found, the eof marker will be cleared and C<$.> will be reset to 0. +If trailing data is present immediately after the zip archive and the +C<Transparent> option is enabled, this method will consider that trailing +data to be another member of the zip archive. + Returns 1 if a new stream was found, 0 if none was found, and -1 if an error was encountered. @@ -1828,6 +1860,12 @@ to read a zip file and unzip its contents to disk. The script is available from L<https://gist.github.com/eqhmcow/5389877> +=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::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> |