summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/IO
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-26 22:16:26 +0000
committerKarl Berry <karl@freefriends.org>2015-04-26 22:16:26 +0000
commit342e672574c4e67d510e46ab6acd0e21a7d0cf54 (patch)
tree79e04202d08c0404bbd780bd26c1e34710e539b6 /Master/tlpkg/tlperl/lib/IO
parentbe2706af7c57a0ef0f4d4e9f684ca4ef74922a82 (diff)
(tl)perl 5.20.2 for windows, from siep
git-svn-id: svn://tug.org/texlive/trunk@37064 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/IO')
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Bzip2.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Deflate.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Identity.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Base.pm8
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Base/Common.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm165
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm16
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/FAQ.pod672
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Gzip.pm25
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Gzip/Constants.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm18
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Zip.pm36
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Zip/Constants.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Zlib/Constants.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Compress/Zlib/Extra.pm4
-rwxr-xr-xMaster/tlpkg/tlperl/lib/IO/HTML.pm22
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Handle.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Select.pm27
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Socket.pm27
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Socket/INET.pm9
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Socket/IP.pm1107
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Socket/UNIX.pm34
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm30
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm50
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm10
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm174
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm24
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm20
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm22
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm37
33 files changed, 2258 insertions, 325 deletions
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Bzip2.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Bzip2.pm
index e665ca3cebf..c77e06b29b7 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Bzip2.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Bzip2.pm
@@ -4,12 +4,12 @@ use strict;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.060 qw(:Status);
+use IO::Compress::Base::Common 2.064 qw(:Status);
-use Compress::Raw::Bzip2 2.060 ;
+use Compress::Raw::Bzip2 2.064 ;
our ($VERSION);
-$VERSION = '2.060';
+$VERSION = '2.064';
sub mkCompObject
{
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Deflate.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Deflate.pm
index d064a141e73..c8fdf2a2c7d 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Deflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Deflate.pm
@@ -4,13 +4,13 @@ use strict;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.060 qw(:Status);
-use Compress::Raw::Zlib 2.060 qw( !crc32 !adler32 ) ;
+use IO::Compress::Base::Common 2.064 qw(:Status);
+use Compress::Raw::Zlib 2.064 qw( !crc32 !adler32 ) ;
require Exporter;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, @EXPORT, %DEFLATE_CONSTANTS);
-$VERSION = '2.060';
+$VERSION = '2.064';
@ISA = qw(Exporter);
@EXPORT_OK = @Compress::Raw::Zlib::DEFLATE_CONSTANTS;
%EXPORT_TAGS = %Compress::Raw::Zlib::DEFLATE_CONSTANTS;
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Identity.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Identity.pm
index 73d911f68e2..b612de0a22b 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Identity.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Adapter/Identity.pm
@@ -4,10 +4,10 @@ use strict;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.060 qw(:Status);
+use IO::Compress::Base::Common 2.064 qw(:Status);
our ($VERSION);
-$VERSION = '2.060';
+$VERSION = '2.064';
sub mkCompObject
{
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Base.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Base.pm
index 9b8ef7552a5..6dc791776ab 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Base.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Base.pm
@@ -6,7 +6,7 @@ require 5.006 ;
use strict ;
use warnings;
-use IO::Compress::Base::Common 2.060 ;
+use IO::Compress::Base::Common 2.064 ;
use IO::File (); ;
use Scalar::Util ();
@@ -20,7 +20,7 @@ use Symbol();
our (@ISA, $VERSION);
@ISA = qw(Exporter IO::File);
-$VERSION = '2.060';
+$VERSION = '2.064';
#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.
@@ -1019,7 +1019,7 @@ IO::Compress::Base - Base Class for IO::Compress modules
=head1 DESCRIPTION
This module is not intended for direct use in application code. Its sole
-purpose if to to be sub-classed by IO::Compress modules.
+purpose is to be sub-classed by IO::Compress modules.
=head1 SEE ALSO
@@ -1041,7 +1041,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Base/Common.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Base/Common.pm
index cce097dd6dc..aa61c792c86 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Base/Common.pm
+++ b/Master/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.060';
+$VERSION = '2.064';
@EXPORT = qw( isaFilehandle isaFilename isaScalar
whatIsInput whatIsOutput
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm
index 7c5dc793e71..fc62b4f4f95 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Bzip2.pm
@@ -5,16 +5,16 @@ use warnings;
use bytes;
require Exporter ;
-use IO::Compress::Base 2.060 ;
+use IO::Compress::Base 2.064 ;
-use IO::Compress::Base::Common 2.060 qw();
-use IO::Compress::Adapter::Bzip2 2.060 ;
+use IO::Compress::Base::Common 2.064 qw();
+use IO::Compress::Adapter::Bzip2 2.064 ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error);
-$VERSION = '2.060';
+$VERSION = '2.064';
$Bzip2Error = '';
@ISA = qw(Exporter IO::Compress::Base);
@@ -51,7 +51,7 @@ sub getExtraParams
{
my $self = shift ;
- use IO::Compress::Base::Common 2.060 qw(:Parse);
+ use IO::Compress::Base::Common 2.064 qw(:Parse);
return (
'blocksize100k' => [IO::Compress::Base::Common::Parse_unsigned, 1],
@@ -204,19 +204,20 @@ section.
use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
- bzip2 $input => $output [,OPTS]
+ bzip2 $input_filename_or_reference => $output_filename_or_reference [,OPTS]
or die "bzip2 failed: $Bzip2Error\n";
The functional interface needs Perl5.005 or better.
-=head2 bzip2 $input => $output [, OPTS]
+=head2 bzip2 $input_filename_or_reference => $output_filename_or_reference [, OPTS]
-C<bzip2> expects at least two parameters, C<$input> and C<$output>.
+C<bzip2> expects at least two parameters,
+C<$input_filename_or_reference> and C<$output_filename_or_reference>.
-=head3 The C<$input> parameter
+=head3 The C<$input_filename_or_reference> parameter
-The parameter, C<$input>, is used to define the source of
-the uncompressed data.
+The parameter, C<$input_filename_or_reference>, is used to define the
+source of the uncompressed data.
It can take one of the following forms:
@@ -224,25 +225,25 @@ It can take one of the following forms:
=item A filename
-If the C<$input> parameter is a simple scalar, it is assumed to be a
-filename. This file will be opened for reading and the input data
-will be read from it.
+If the <$input_filename_or_reference> parameter is a simple scalar, it is
+assumed to be a filename. This file will be opened for reading and the
+input data will be read from it.
=item A filehandle
-If the C<$input> parameter is a filehandle, the input data will be
-read from it.
-The string '-' can be used as an alias for standard input.
+If the C<$input_filename_or_reference> parameter is a filehandle, the input
+data will be read from it. The string '-' can be used as an alias for
+standard input.
=item A scalar reference
-If C<$input> is a scalar reference, the input data will be read
-from C<$$input>.
+If C<$input_filename_or_reference> is a scalar reference, the input data
+will be read from C<$$input_filename_or_reference>.
=item An array reference
-If C<$input> is an array reference, each element in the array must be a
-filename.
+If C<$input_filename_or_reference> is an array reference, each element in
+the array must be a filename.
The input data will be read from each file in turn.
@@ -251,65 +252,72 @@ contains valid filenames before any data is compressed.
=item An Input FileGlob string
-If C<$input> is a string that is delimited by the characters "<" and ">"
-C<bzip2> will assume that it is an I<input fileglob string>. The
-input is the list of files that match the fileglob.
-
-If the fileglob does not match any files ...
+If C<$input_filename_or_reference> is a string that is delimited by the
+characters "<" and ">" C<bzip2> will assume that it is an
+I<input fileglob string>. The input is the list of files that match the
+fileglob.
See L<File::GlobMapper|File::GlobMapper> for more details.
=back
-If the C<$input> parameter is any other type, C<undef> will be returned.
+If the C<$input_filename_or_reference> parameter is any other type,
+C<undef> will be returned.
-=head3 The C<$output> parameter
+=head3 The C<$output_filename_or_reference> parameter
-The parameter C<$output> is used to control the destination of the
-compressed data. This parameter can take one of these forms.
+The parameter C<$output_filename_or_reference> is used to control the
+destination of the compressed data. This parameter can take one of
+these forms.
=over 5
=item A filename
-If the C<$output> parameter is a simple scalar, it is assumed to be a
-filename. This file will be opened for writing and the compressed
-data will be written to it.
+If the C<$output_filename_or_reference> parameter is a simple scalar, it is
+assumed to be a filename. This file will be opened for writing and the
+compressed data will be written to it.
=item A filehandle
-If the C<$output> parameter is a filehandle, the compressed data
-will be written to it.
-The string '-' can be used as an alias for standard output.
+If the C<$output_filename_or_reference> parameter is a filehandle, the
+compressed data will be written to it. The string '-' can be used as
+an alias for standard output.
=item A scalar reference
-If C<$output> is a scalar reference, the compressed data will be
-stored in C<$$output>.
+If C<$output_filename_or_reference> is a scalar reference, the
+compressed data will be stored in C<$$output_filename_or_reference>.
=item An Array Reference
-If C<$output> is an array reference, the compressed data will be
-pushed onto the array.
+If C<$output_filename_or_reference> is an array reference,
+the compressed data will be pushed onto the array.
=item An Output FileGlob
-If C<$output> is a string that is delimited by the characters "<" and ">"
-C<bzip2> will assume that it is an I<output fileglob string>. The
-output is the list of files that match the fileglob.
+If C<$output_filename_or_reference> is a string that is delimited by the
+characters "<" and ">" C<bzip2> will assume that it is an
+I<output fileglob string>. The output is the list of files that match the
+fileglob.
-When C<$output> is an fileglob string, C<$input> must also be a fileglob
-string. Anything else is an error.
+When C<$output_filename_or_reference> is an fileglob string,
+C<$input_filename_or_reference> must also be a fileglob string. Anything
+else is an error.
+
+See L<File::GlobMapper|File::GlobMapper> for more details.
=back
-If the C<$output> parameter is any other type, C<undef> will be returned.
+If the C<$output_filename_or_reference> parameter is any other type,
+C<undef> will be returned.
=head2 Notes
-When C<$input> maps to multiple files/buffers and C<$output> is a single
+When C<$input_filename_or_reference> maps to multiple files/buffers and
+C<$output_filename_or_reference> is a single
file/buffer the input files/buffers will be stored
-in C<$output> as a concatenated series of compressed data streams.
+in C<$output_filename_or_reference> as a concatenated series of compressed data streams.
=head2 Optional Parameters
@@ -338,7 +346,48 @@ Defaults to 0.
=item C<< Append => 0|1 >>
-TODO
+The behaviour of this option is dependent on the type of output data
+stream.
+
+=over 5
+
+=item * A Buffer
+
+If C<Append> is enabled, all compressed data will be append to the end of
+the output buffer. Otherwise the output buffer will be cleared before any
+compressed data is written to it.
+
+=item * A Filename
+
+If C<Append> is enabled, the file will be opened in append mode. Otherwise
+the contents of the file, if any, will be truncated before any compressed
+data is written to it.
+
+=item * A Filehandle
+
+If C<Append> is enabled, the filehandle will be positioned to the end of
+the file via a call to C<seek> before any compressed data is
+written to it. Otherwise the file pointer will not be moved.
+
+=back
+
+When C<Append> is specified, and set to true, it will I<append> all compressed
+data to the output data stream.
+
+So when the output is a filehandle it will carry out a seek to the eof
+before writing any compressed data. If the output is a filename, it will be opened for
+appending. If the output is a buffer, all compressed data will be
+appended to the existing buffer.
+
+Conversely when C<Append> is not specified, or it is present and is set to
+false, it will operate as follows.
+
+When the output is a filename, it will truncate the contents of the file
+before writing any compressed data. If the output is a filehandle
+its position will not be changed. If the output is a buffer, it will be
+wiped before any compressed data is output.
+
+Defaults to 0.
=back
@@ -467,7 +516,7 @@ The behaviour of this option is dependent on the type of C<$output>.
=item * A Buffer
If C<$output> is a buffer and C<Append> is enabled, all compressed data
-will be append to the end if C<$output>. Otherwise C<$output> will be
+will be append to the end of C<$output>. Otherwise C<$output> will be
cleared before any data is written to it.
=item * A Filename
@@ -657,7 +706,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno>
will return the underlying file descriptor. Once the C<close> method is
called C<fileno> will return C<undef>.
-If the C<$z> object is is associated with a buffer, this method will return
+If the C<$z> object is associated with a buffer, this method will return
C<undef>.
=head2 close
@@ -693,7 +742,7 @@ Usage is
Closes the current compressed data stream and starts a new one.
-OPTS consists of any of the the options that are available when creating
+OPTS consists of any of the options that are available when creating
the C<$z> object.
See the L</"Constructor Options"> section for more details.
@@ -719,19 +768,17 @@ Same as doing this
=head2 Apache::GZip Revisited
-See L<IO::Compress::Bzip2::FAQ|IO::Compress::Bzip2::FAQ/"Apache::GZip Revisited">
-
-
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Apache::GZip Revisited">
=head2 Working with Net::FTP
-See L<IO::Compress::Bzip2::FAQ|IO::Compress::Bzip2::FAQ/"Compressed files and Net::FTP">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP">
=head1 SEE ALSO
-L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
+L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
-L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
+L<IO::Compress::FAQ|IO::Compress::FAQ>
L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
L<Archive::Tar|Archive::Tar>,
@@ -751,7 +798,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm
index d6158deb5bf..d8848d7f696 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Deflate.pm
@@ -8,16 +8,16 @@ use bytes;
require Exporter ;
-use IO::Compress::RawDeflate 2.060 ();
-use IO::Compress::Adapter::Deflate 2.060 ;
+use IO::Compress::RawDeflate 2.064 ();
+use IO::Compress::Adapter::Deflate 2.064 ;
-use IO::Compress::Zlib::Constants 2.060 ;
-use IO::Compress::Base::Common 2.060 qw();
+use IO::Compress::Zlib::Constants 2.064 ;
+use IO::Compress::Base::Common 2.064 qw();
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $DeflateError);
-$VERSION = '2.060';
+$VERSION = '2.064';
$DeflateError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
@@ -238,7 +238,7 @@ section.
The functional interface needs Perl5.005 or better.
-=head2 deflate $input => $output [, OPTS]
+=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>.
@@ -821,7 +821,7 @@ Usage is
Closes the current compressed data stream and starts a new one.
-OPTS consists of any of the the options that are available when creating
+OPTS consists of any of the options that are available when creating
the C<$z> object.
See the L</"Constructor Options"> section for more details.
@@ -932,7 +932,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/FAQ.pod b/Master/tlpkg/tlperl/lib/IO/Compress/FAQ.pod
new file mode 100644
index 00000000000..671824dc15f
--- /dev/null
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/FAQ.pod
@@ -0,0 +1,672 @@
+
+=head1 NAME
+
+IO::Compress::FAQ -- Frequently Asked Questions about IO::Compress
+
+=head1 DESCRIPTION
+
+Common questions answered.
+
+=head1 GENERAL
+
+=head2 Compatibility with Unix compress/uncompress.
+
+Although C<Compress::Zlib> has a pair of functions called C<compress> and
+C<uncompress>, they are I<not> related to the Unix programs of the same
+name. The C<Compress::Zlib> module is not compatible with Unix
+C<compress>.
+
+If you have the C<uncompress> program available, you can use this to read
+compressed files
+
+ open F, "uncompress -c $filename |";
+ while (<F>)
+ {
+ ...
+
+Alternatively, if you have the C<gunzip> program available, you can use
+this to read compressed files
+
+ open F, "gunzip -c $filename |";
+ while (<F>)
+ {
+ ...
+
+and this to write compress files, if you have the C<compress> program
+available
+
+ open F, "| compress -c $filename ";
+ print F "data";
+ ...
+ close F ;
+
+=head2 Accessing .tar.Z files
+
+The C<Archive::Tar> module can optionally use C<Compress::Zlib> (via the
+C<IO::Zlib> module) to access tar files that have been compressed with
+C<gzip>. Unfortunately tar files compressed with the Unix C<compress>
+utility cannot be read by C<Compress::Zlib> and so cannot be directly
+accessed by C<Archive::Tar>.
+
+If the C<uncompress> or C<gunzip> programs are available, you can use one
+of these workarounds to read C<.tar.Z> files from C<Archive::Tar>
+
+Firstly with C<uncompress>
+
+ use strict;
+ use warnings;
+ use Archive::Tar;
+
+ open F, "uncompress -c $filename |";
+ my $tar = Archive::Tar->new(*F);
+ ...
+
+and this with C<gunzip>
+
+ use strict;
+ use warnings;
+ use Archive::Tar;
+
+ open F, "gunzip -c $filename |";
+ my $tar = Archive::Tar->new(*F);
+ ...
+
+Similarly, if the C<compress> program is available, you can use this to
+write a C<.tar.Z> file
+
+ use strict;
+ use warnings;
+ use Archive::Tar;
+ use IO::File;
+
+ my $fh = new IO::File "| compress -c >$filename";
+ my $tar = Archive::Tar->new();
+ ...
+ $tar->write($fh);
+ $fh->close ;
+
+=head2 How do I recompress using a different compression?
+
+This is easier that you might expect if you realise that all the
+C<IO::Compress::*> objects are derived from C<IO::File> and that all the
+C<IO::Uncompress::*> modules can read from an C<IO::File> filehandle.
+
+So, for example, say you have a file compressed with gzip that you want to
+recompress with bzip2. Here is all that is needed to carry out the
+recompression.
+
+ use IO::Uncompress::Gunzip ':all';
+ use IO::Compress::Bzip2 ':all';
+
+ my $gzipFile = "somefile.gz";
+ my $bzipFile = "somefile.bz2";
+
+ my $gunzip = new IO::Uncompress::Gunzip $gzipFile
+ or die "Cannot gunzip $gzipFile: $GunzipError\n" ;
+
+ bzip2 $gunzip => $bzipFile
+ or die "Cannot bzip2 to $bzipFile: $Bzip2Error\n" ;
+
+Note, there is a limitation of this technique. Some compression file
+formats store extra information along with the compressed data payload. For
+example, gzip can optionally store the original filename and Zip stores a
+lot of information about the original file. If the original compressed file
+contains any of this extra information, it will not be transferred to the
+new compressed file using the technique above.
+
+=head1 ZIP
+
+=head2 What Compression Types do IO::Compress::Zip & IO::Uncompress::Unzip support?
+
+The following compression formats are supported by C<IO::Compress::Zip> and
+C<IO::Uncompress::Unzip>
+
+=over 5
+
+=item * Store (method 0)
+
+No compression at all.
+
+=item * Deflate (method 8)
+
+This is the default compression used when creating a zip file with
+C<IO::Compress::Zip>.
+
+=item * Bzip2 (method 12)
+
+Only supported if the C<IO-Compress-Bzip2> module is installed.
+
+=item * Lzma (method 14)
+
+Only supported if the C<IO-Compress-Lzma> module is installed.
+
+=back
+
+=head2 Can I Read/Write Zip files larger the 4 Gig?
+
+Yes, both the C<IO-Compress-Zip> and C<IO-Uncompress-Unzip> modules
+support the zip feature called I<Zip64>. That allows them to read/write
+files/buffers larger than 4Gig.
+
+If you are creating a Zip file using the one-shot interface, and any of the
+input files is greater than 4Gig, a zip64 complaint zip file will be
+created.
+
+ zip "really-large-file" => "my.zip";
+
+Similarly with the one-shot interface, if the input is a buffer larger than
+4 Gig, a zip64 complaint zip file will be created.
+
+ zip \$really_large_buffer => "my.zip";
+
+The one-shot interface allows you to force the creation of a zip64 zip file
+by including the C<Zip64> option.
+
+ zip $filehandle => "my.zip", Zip64 => 1;
+
+If you want to create a zip64 zip file with the OO interface you must
+specify the C<Zip64> option.
+
+ my $zip = new IO::Compress::Zip "whatever", Zip64 => 1;
+
+When uncompressing with C<IO-Uncompress-Unzip>, it will automatically
+detect if the zip file is zip64.
+
+If you intend to manipulate the Zip64 zip files created with
+C<IO-Compress-Zip> 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.
+
+=head2 Can I write more that 64K entries is a Zip files?
+
+Yes. Zip64 allows this. See previous question.
+
+=head2 Zip Resources
+
+The primary reference for zip files is the "appnote" document available at
+L<http://www.pkware.com/documents/casestudies/APPNOTE.TXT>
+
+An alternatively is the Info-Zip appnote. This is available from
+L<ftp://ftp.info-zip.org/pub/infozip/doc/>
+
+=head1 GZIP
+
+=head2 Gzip Resources
+
+The primary reference for gzip files is RFC 1952
+L<http://www.faqs.org/rfcs/rfc1952.html>
+
+The primary site for gzip is F<http://www.gzip.org>.
+
+=head2 Dealing with Concatenated gzip files
+
+If the gunzip program encounters a file containing multiple gzip files
+concatenated together it will automatically uncompress them all.
+The example below illustrates this behaviour
+
+ $ echo abc | gzip -c >x.gz
+ $ echo def | gzip -c >>x.gz
+ $ gunzip -c x.gz
+ abc
+ def
+
+By default C<IO::Uncompress::Gunzip> will I<not> behave like the gunzip
+program. It will only uncompress the first gzip data stream in the file, as
+shown below
+
+ $ perl -MIO::Uncompress::Gunzip=:all -e 'gunzip "x.gz" => \*STDOUT'
+ abc
+
+To force C<IO::Uncompress::Gunzip> to uncompress all the gzip data streams,
+include the C<MultiStream> option, as shown below
+
+ $ perl -MIO::Uncompress::Gunzip=:all -e 'gunzip "x.gz" => \*STDOUT, MultiStream => 1'
+ abc
+ def
+
+=head1 ZLIB
+
+=head2 Zlib Resources
+
+The primary site for the I<zlib> compression library is
+F<http://www.zlib.org>.
+
+=head1 Bzip2
+
+=head2 Bzip2 Resources
+
+The primary site for bzip2 is F<http://www.bzip.org>.
+
+=head2 Dealing with Concatenated bzip2 files
+
+If the bunzip2 program encounters a file containing multiple bzip2 files
+concatenated together it will automatically uncompress them all.
+The example below illustrates this behaviour
+
+ $ echo abc | bzip2 -c >x.bz2
+ $ echo def | bzip2 -c >>x.bz2
+ $ bunzip2 -c x.bz2
+ abc
+ def
+
+By default C<IO::Uncompress::Bunzip2> will I<not> behave like the bunzip2
+program. It will only uncompress the first bunzip2 data stream in the file, as
+shown below
+
+ $ perl -MIO::Uncompress::Bunzip2=:all -e 'bunzip2 "x.bz2" => \*STDOUT'
+ abc
+
+To force C<IO::Uncompress::Bunzip2> to uncompress all the bzip2 data streams,
+include the C<MultiStream> option, as shown below
+
+ $ perl -MIO::Uncompress::Bunzip2=:all -e 'bunzip2 "x.bz2" => \*STDOUT, MultiStream => 1'
+ abc
+ def
+
+=head2 Interoperating with Pbzip2
+
+Pbzip2 (L<http://compression.ca/pbzip2/>) is a parallel implementation of
+bzip2. The output from pbzip2 consists of a series of concatenated bzip2
+data streams.
+
+By default C<IO::Uncompress::Bzip2> will only uncompress the first bzip2
+data stream in a pbzip2 file. To uncompress the complete pbzip2 file you
+must include the C<MultiStream> option, like this.
+
+ bunzip2 $input => \$output, MultiStream => 1
+ or die "bunzip2 failed: $Bunzip2Error\n";
+
+=head1 HTTP & NETWORK
+
+=head2 Apache::GZip Revisited
+
+Below is a mod_perl Apache compression module, called C<Apache::GZip>,
+taken from
+F<http://perl.apache.org/docs/tutorials/tips/mod_perl_tricks/mod_perl_tricks.html#On_the_Fly_Compression>
+
+ package Apache::GZip;
+ #File: Apache::GZip.pm
+
+ use strict vars;
+ use Apache::Constants ':common';
+ use Compress::Zlib;
+ use IO::File;
+ use constant GZIP_MAGIC => 0x1f8b;
+ use constant OS_MAGIC => 0x03;
+
+ sub handler {
+ my $r = shift;
+ my ($fh,$gz);
+ my $file = $r->filename;
+ return DECLINED unless $fh=IO::File->new($file);
+ $r->header_out('Content-Encoding'=>'gzip');
+ $r->send_http_header;
+ return OK if $r->header_only;
+
+ tie *STDOUT,'Apache::GZip',$r;
+ print($_) while <$fh>;
+ untie *STDOUT;
+ return OK;
+ }
+
+ sub TIEHANDLE {
+ my($class,$r) = @_;
+ # initialize a deflation stream
+ my $d = deflateInit(-WindowBits=>-MAX_WBITS()) || return undef;
+
+ # gzip header -- don't ask how I found out
+ $r->print(pack("nccVcc",GZIP_MAGIC,Z_DEFLATED,0,time(),0,OS_MAGIC));
+
+ return bless { r => $r,
+ crc => crc32(undef),
+ d => $d,
+ l => 0
+ },$class;
+ }
+
+ sub PRINT {
+ my $self = shift;
+ foreach (@_) {
+ # deflate the data
+ my $data = $self->{d}->deflate($_);
+ $self->{r}->print($data);
+ # keep track of its length and crc
+ $self->{l} += length($_);
+ $self->{crc} = crc32($_,$self->{crc});
+ }
+ }
+
+ sub DESTROY {
+ my $self = shift;
+
+ # flush the output buffers
+ my $data = $self->{d}->flush;
+ $self->{r}->print($data);
+
+ # print the CRC and the total length (uncompressed)
+ $self->{r}->print(pack("LL",@{$self}{qw/crc l/}));
+ }
+
+ 1;
+
+Here's the Apache configuration entry you'll need to make use of it. Once
+set it will result in everything in the /compressed directory will be
+compressed automagically.
+
+ <Location /compressed>
+ SetHandler perl-script
+ PerlHandler Apache::GZip
+ </Location>
+
+Although at first sight there seems to be quite a lot going on in
+C<Apache::GZip>, you could sum up what the code was doing as follows --
+read the contents of the file in C<< $r->filename >>, compress it and write
+the compressed data to standard output. That's all.
+
+This code has to jump through a few hoops to achieve this because
+
+=over
+
+=item 1.
+
+The gzip support in C<Compress::Zlib> version 1.x can only work with a real
+filesystem filehandle. The filehandles used by Apache modules are not
+associated with the filesystem.
+
+=item 2.
+
+That means all the gzip support has to be done by hand - in this case by
+creating a tied filehandle to deal with creating the gzip header and
+trailer.
+
+=back
+
+C<IO::Compress::Gzip> doesn't have that filehandle limitation (this was one
+of the reasons for writing it in the first place). So if
+C<IO::Compress::Gzip> is used instead of C<Compress::Zlib> the whole tied
+filehandle code can be removed. Here is the rewritten code.
+
+ package Apache::GZip;
+
+ use strict vars;
+ use Apache::Constants ':common';
+ use IO::Compress::Gzip;
+ use IO::File;
+
+ sub handler {
+ my $r = shift;
+ my ($fh,$gz);
+ my $file = $r->filename;
+ return DECLINED unless $fh=IO::File->new($file);
+ $r->header_out('Content-Encoding'=>'gzip');
+ $r->send_http_header;
+ return OK if $r->header_only;
+
+ my $gz = new IO::Compress::Gzip '-', Minimal => 1
+ or return DECLINED ;
+
+ print $gz $_ while <$fh>;
+
+ return OK;
+ }
+
+or even more succinctly, like this, using a one-shot gzip
+
+ package Apache::GZip;
+
+ use strict vars;
+ use Apache::Constants ':common';
+ use IO::Compress::Gzip qw(gzip);
+
+ sub handler {
+ my $r = shift;
+ $r->header_out('Content-Encoding'=>'gzip');
+ $r->send_http_header;
+ return OK if $r->header_only;
+
+ gzip $r->filename => '-', Minimal => 1
+ or return DECLINED ;
+
+ return OK;
+ }
+
+ 1;
+
+The use of one-shot C<gzip> above just reads from C<< $r->filename >> and
+writes the compressed data to standard output.
+
+Note the use of the C<Minimal> option in the code above. When using gzip
+for Content-Encoding you should I<always> use this option. In the example
+above it will prevent the filename being included in the gzip header and
+make the size of the gzip data stream a slight bit smaller.
+
+=head2 Compressed files and Net::FTP
+
+The C<Net::FTP> module provides two low-level methods called C<stor> and
+C<retr> that both return filehandles. These filehandles can used with the
+C<IO::Compress/Uncompress> modules to compress or uncompress files read
+from or written to an FTP Server on the fly, without having to create a
+temporary file.
+
+Firstly, here is code that uses C<retr> to uncompressed a file as it is
+read from the FTP Server.
+
+ use Net::FTP;
+ use IO::Uncompress::Gunzip qw(:all);
+
+ my $ftp = new Net::FTP ...
+
+ my $retr_fh = $ftp->retr($compressed_filename);
+ gunzip $retr_fh => $outFilename, AutoClose => 1
+ or die "Cannot uncompress '$compressed_file': $GunzipError\n";
+
+and this to compress a file as it is written to the FTP Server
+
+ use Net::FTP;
+ use IO::Compress::Gzip qw(:all);
+
+ my $stor_fh = $ftp->stor($filename);
+ gzip "filename" => $stor_fh, AutoClose => 1
+ or die "Cannot compress '$filename': $GzipError\n";
+
+=head1 MISC
+
+=head2 Using C<InputLength> to uncompress data embedded in a larger file/buffer.
+
+A fairly common use-case is where compressed data is embedded in a larger
+file/buffer and you want to read both.
+
+As an example consider the structure of a zip file. This is a well-defined
+file format that mixes both compressed and uncompressed sections of data in
+a single file.
+
+For the purposes of this discussion you can think of a zip file as sequence
+of compressed data streams, each of which is prefixed by an uncompressed
+local header. The local header contains information about the compressed
+data stream, including the name of the compressed file and, in particular,
+the length of the compressed data stream.
+
+To illustrate how to use C<InputLength> here is a script that walks a zip
+file and prints out how many lines are in each compressed file (if you
+intend write code to walking through a zip file for real see
+L<IO::Uncompress::Unzip/"Walking through a zip file"> ). Also, although
+this example uses the zlib-based compression, the technique can be used by
+the other C<IO::Uncompress::*> modules.
+
+ use strict;
+ use warnings;
+
+ use IO::File;
+ use IO::Uncompress::RawInflate qw(:all);
+
+ use constant ZIP_LOCAL_HDR_SIG => 0x04034b50;
+ use constant ZIP_LOCAL_HDR_LENGTH => 30;
+
+ my $file = $ARGV[0] ;
+
+ my $fh = new IO::File "<$file"
+ or die "Cannot open '$file': $!\n";
+
+ while (1)
+ {
+ my $sig;
+ my $buffer;
+
+ my $x ;
+ ($x = $fh->read($buffer, ZIP_LOCAL_HDR_LENGTH)) == ZIP_LOCAL_HDR_LENGTH
+ or die "Truncated file: $!\n";
+
+ my $signature = unpack ("V", substr($buffer, 0, 4));
+
+ last unless $signature == ZIP_LOCAL_HDR_SIG;
+
+ # Read Local Header
+ my $gpFlag = unpack ("v", substr($buffer, 6, 2));
+ my $compressedMethod = unpack ("v", substr($buffer, 8, 2));
+ my $compressedLength = unpack ("V", substr($buffer, 18, 4));
+ my $uncompressedLength = unpack ("V", substr($buffer, 22, 4));
+ my $filename_length = unpack ("v", substr($buffer, 26, 2));
+ my $extra_length = unpack ("v", substr($buffer, 28, 2));
+
+ my $filename ;
+ $fh->read($filename, $filename_length) == $filename_length
+ or die "Truncated file\n";
+
+ $fh->read($buffer, $extra_length) == $extra_length
+ or die "Truncated file\n";
+
+ if ($compressedMethod != 8 && $compressedMethod != 0)
+ {
+ warn "Skipping file '$filename' - not deflated $compressedMethod\n";
+ $fh->read($buffer, $compressedLength) == $compressedLength
+ or die "Truncated file\n";
+ next;
+ }
+
+ if ($compressedMethod == 0 && $gpFlag & 8 == 8)
+ {
+ die "Streamed Stored not supported for '$filename'\n";
+ }
+
+ next if $compressedLength == 0;
+
+ # Done reading the Local Header
+
+ my $inf = new IO::Uncompress::RawInflate $fh,
+ Transparent => 1,
+ InputLength => $compressedLength
+ or die "Cannot uncompress $file [$filename]: $RawInflateError\n" ;
+
+ my $line_count = 0;
+
+ while (<$inf>)
+ {
+ ++ $line_count;
+ }
+
+ print "$filename: $line_count\n";
+ }
+
+The majority of the code above is concerned with reading the zip local
+header data. The code that I want to focus on is at the bottom.
+
+ while (1) {
+
+ # read local zip header data
+ # get $filename
+ # get $compressedLength
+
+ my $inf = new IO::Uncompress::RawInflate $fh,
+ Transparent => 1,
+ InputLength => $compressedLength
+ or die "Cannot uncompress $file [$filename]: $RawInflateError\n" ;
+
+ my $line_count = 0;
+
+ while (<$inf>)
+ {
+ ++ $line_count;
+ }
+
+ print "$filename: $line_count\n";
+ }
+
+The call to C<IO::Uncompress::RawInflate> creates a new filehandle C<$inf>
+that can be used to read from the parent filehandle C<$fh>, uncompressing
+it as it goes. The use of the C<InputLength> option will guarantee that
+I<at most> C<$compressedLength> bytes of compressed data will be read from
+the C<$fh> filehandle (The only exception is for an error case like a
+truncated file or a corrupt data stream).
+
+This means that once RawInflate is finished C<$fh> will be left at the
+byte directly after the compressed data stream.
+
+Now consider what the code looks like without C<InputLength>
+
+ while (1) {
+
+ # read local zip header data
+ # get $filename
+ # get $compressedLength
+
+ # read all the compressed data into $data
+ read($fh, $data, $compressedLength);
+
+ my $inf = new IO::Uncompress::RawInflate \$data,
+ Transparent => 1,
+ or die "Cannot uncompress $file [$filename]: $RawInflateError\n" ;
+
+ my $line_count = 0;
+
+ while (<$inf>)
+ {
+ ++ $line_count;
+ }
+
+ print "$filename: $line_count\n";
+ }
+
+The difference here is the addition of the temporary variable C<$data>.
+This is used to store a copy of the compressed data while it is being
+uncompressed.
+
+If you know that C<$compressedLength> isn't that big then using temporary
+storage won't be a problem. But if C<$compressedLength> is very large or
+you are writing an application that other people will use, and so have no
+idea how big C<$compressedLength> will be, it could be an issue.
+
+Using C<InputLength> avoids the use of temporary storage and means the
+application can cope with large compressed data streams.
+
+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 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::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
+
+L<IO::Compress::FAQ|IO::Compress::FAQ>
+
+L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
+L<Archive::Tar|Archive::Tar>,
+L<IO::Zlib|IO::Zlib>
+
+=head1 AUTHOR
+
+This module was written by Paul Marquess, F<pmqs@cpan.org>.
+
+=head1 MODIFICATION HISTORY
+
+See the Changes file.
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
+
+This program is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Gzip.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Gzip.pm
index 21141530e7c..febeea6ca91 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Gzip.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Gzip.pm
@@ -8,12 +8,12 @@ use bytes;
require Exporter ;
-use IO::Compress::RawDeflate 2.060 () ;
-use IO::Compress::Adapter::Deflate 2.060 ;
+use IO::Compress::RawDeflate 2.064 () ;
+use IO::Compress::Adapter::Deflate 2.064 ;
-use IO::Compress::Base::Common 2.060 qw(:Status );
-use IO::Compress::Gzip::Constants 2.060 ;
-use IO::Compress::Zlib::Extra 2.060 ;
+use IO::Compress::Base::Common 2.064 qw(:Status );
+use IO::Compress::Gzip::Constants 2.064 ;
+use IO::Compress::Zlib::Extra 2.064 ;
BEGIN
{
@@ -25,7 +25,7 @@ BEGIN
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $GzipError);
-$VERSION = '2.060';
+$VERSION = '2.064';
$GzipError = '' ;
@ISA = qw(Exporter IO::Compress::RawDeflate);
@@ -194,7 +194,7 @@ sub mkHeader
my $self = shift ;
my $param = shift ;
- # stort-circuit if a minimal header is requested.
+ # short-circuit if a minimal header is requested.
return GZIP_MINIMUM_HEADER if $param->getValue('minimal') ;
# METHOD
@@ -257,7 +257,8 @@ sub mkHeader
}
# HEADER CRC
- $out .= pack("v", Compress::Raw::Zlib::crc32($out) & 0x00FF ) if $param->getValue('headercrc') ;
+ $out .= pack("v", Compress::Raw::Zlib::crc32($out) & 0x00FF )
+ if $param->getValue('headercrc') ;
noUTF8($out);
@@ -347,7 +348,7 @@ section.
The functional interface needs Perl5.005 or better.
-=head2 gzip $input => $output [, OPTS]
+=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>.
@@ -801,7 +802,7 @@ and set the CRC16 header field to the CRC of the complete gzip header
except the CRC16 field itself.
B<Note> that gzip files created with the C<HeaderCRC> flag set to 1 cannot
-be read by most, if not all, of the the standard gunzip utilities, most
+be read by most, if not all, of the standard gunzip utilities, most
notably gzip version 1.2.4. You should therefore avoid using this option if
you want to maximize the portability of your gzip files.
@@ -1132,7 +1133,7 @@ Usage is
Closes the current compressed data stream and starts a new one.
-OPTS consists of any of the the options that are available when creating
+OPTS consists of any of the options that are available when creating
the C<$z> object.
See the L</"Constructor Options"> section for more details.
@@ -1243,7 +1244,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Gzip/Constants.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Gzip/Constants.pm
index b65f56b91f3..f6c15c72c9a 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Gzip/Constants.pm
+++ b/Master/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.060';
+$VERSION = '2.064';
@ISA = qw(Exporter);
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm b/Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm
index 0862e6e216d..38f7f7dab0e 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/RawDeflate.pm
@@ -6,15 +6,15 @@ use strict ;
use warnings;
use bytes;
-use IO::Compress::Base 2.060 ;
-use IO::Compress::Base::Common 2.060 qw(:Status );
-use IO::Compress::Adapter::Deflate 2.060 ;
+use IO::Compress::Base 2.064 ;
+use IO::Compress::Base::Common 2.064 qw(:Status );
+use IO::Compress::Adapter::Deflate 2.064 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError);
-$VERSION = '2.060';
+$VERSION = '2.064';
$RawDeflateError = '';
@ISA = qw(Exporter IO::Compress::Base);
@@ -116,8 +116,8 @@ sub getExtraParams
return getZlibParams();
}
-use IO::Compress::Base::Common 2.060 qw(:Parse);
-use Compress::Raw::Zlib 2.060 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+use IO::Compress::Base::Common 2.064 qw(:Parse);
+use Compress::Raw::Zlib 2.064 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],
@@ -294,7 +294,7 @@ section.
The functional interface needs Perl5.005 or better.
-=head2 rawdeflate $input => $output [, OPTS]
+=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>.
@@ -877,7 +877,7 @@ Usage is
Closes the current compressed data stream and starts a new one.
-OPTS consists of any of the the options that are available when creating
+OPTS consists of any of the options that are available when creating
the C<$z> object.
See the L</"Constructor Options"> section for more details.
@@ -988,7 +988,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Zip.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Zip.pm
index a5bf89ecc40..a8645b346af 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Zip.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Zip.pm
@@ -4,30 +4,30 @@ use strict ;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.060 qw(:Status );
-use IO::Compress::RawDeflate 2.060 ();
-use IO::Compress::Adapter::Deflate 2.060 ;
-use IO::Compress::Adapter::Identity 2.060 ;
-use IO::Compress::Zlib::Extra 2.060 ;
-use IO::Compress::Zip::Constants 2.060 ;
+use IO::Compress::Base::Common 2.064 qw(:Status );
+use IO::Compress::RawDeflate 2.064 ();
+use IO::Compress::Adapter::Deflate 2.064 ;
+use IO::Compress::Adapter::Identity 2.064 ;
+use IO::Compress::Zlib::Extra 2.064 ;
+use IO::Compress::Zip::Constants 2.064 ;
use File::Spec();
use Config;
-use Compress::Raw::Zlib 2.060 ();
+use Compress::Raw::Zlib 2.064 ();
BEGIN
{
eval { require IO::Compress::Adapter::Bzip2 ;
- import IO::Compress::Adapter::Bzip2 2.060 ;
+ import IO::Compress::Adapter::Bzip2 2.064 ;
require IO::Compress::Bzip2 ;
- import IO::Compress::Bzip2 2.060 ;
+ import IO::Compress::Bzip2 2.064 ;
} ;
eval { require IO::Compress::Adapter::Lzma ;
- import IO::Compress::Adapter::Lzma 2.060 ;
+ import IO::Compress::Adapter::Lzma 2.064 ;
require IO::Compress::Lzma ;
- import IO::Compress::Lzma 2.060 ;
+ import IO::Compress::Lzma 2.064 ;
} ;
}
@@ -36,7 +36,7 @@ require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $ZipError);
-$VERSION = '2.060';
+$VERSION = '2.064';
$ZipError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
@@ -939,7 +939,7 @@ section.
The functional interface needs Perl5.005 or better.
-=head2 zip $input => $output [, OPTS]
+=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>.
@@ -1328,7 +1328,7 @@ normalized filename will be passed to the sub.
If you use C<FilterName> to modify the filename, it is your responsibility
to keep the filename in Unix format.
-Although this option can be used with the OO ointerface, it is of most use
+Although this option can be used with the OO interface, it is of most use
with the one-shot interface. For example, the code below shows how
C<FilterName> can be used to remove the path component from a series of
filenames before they are stored in C<$zipfile>.
@@ -1410,7 +1410,7 @@ and C<$gid>. These values correspond to the numeric User ID (UID) and Group ID
(GID) of the owner of the files respectively.
When the C<exUnixN> option is present it will trigger the creation of a
-UnixN extra field (ID is "ux") in bothe the local and central zip headers.
+UnixN extra field (ID is "ux") in both the local and central zip headers.
This will be populated with C<$uid> and C<$gid>.
The UID & GID are stored as 32-bit integers.
@@ -1586,7 +1586,7 @@ 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 compession with the highest memory usage but with the best
+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
@@ -1833,7 +1833,7 @@ Usage is
Closes the current compressed data stream and starts a new one.
-OPTS consists of any of the the options that are available when creating
+OPTS consists of any of the options that are available when creating
the C<$z> object.
See the L</"Constructor Options"> section for more details.
@@ -1953,7 +1953,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Zip/Constants.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Zip/Constants.pm
index 64cfc2685c6..02609b940a4 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Zip/Constants.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Zip/Constants.pm
@@ -7,7 +7,7 @@ require Exporter;
our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS);
-$VERSION = '2.060';
+$VERSION = '2.064';
@ISA = qw(Exporter);
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Zlib/Constants.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Zlib/Constants.pm
index 328fc4aa8e6..7dd1622dfb2 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Zlib/Constants.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Zlib/Constants.pm
@@ -9,7 +9,7 @@ require Exporter;
our ($VERSION, @ISA, @EXPORT);
-$VERSION = '2.060';
+$VERSION = '2.064';
@ISA = qw(Exporter);
diff --git a/Master/tlpkg/tlperl/lib/IO/Compress/Zlib/Extra.pm b/Master/tlpkg/tlperl/lib/IO/Compress/Zlib/Extra.pm
index d320dccabd4..ca92b5f9bd9 100644
--- a/Master/tlpkg/tlperl/lib/IO/Compress/Zlib/Extra.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Compress/Zlib/Extra.pm
@@ -8,9 +8,9 @@ use bytes;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = '2.060';
+$VERSION = '2.064';
-use IO::Compress::Gzip::Constants 2.060 ;
+use IO::Compress::Gzip::Constants 2.064 ;
sub ExtraFieldError
{
diff --git a/Master/tlpkg/tlperl/lib/IO/HTML.pm b/Master/tlpkg/tlperl/lib/IO/HTML.pm
index 317f3e1faa9..5fdad2237e1 100755
--- a/Master/tlpkg/tlperl/lib/IO/HTML.pm
+++ b/Master/tlpkg/tlperl/lib/IO/HTML.pm
@@ -1,7 +1,7 @@
#---------------------------------------------------------------------
package IO::HTML;
#
-# Copyright 2012 Christopher J. Madsen
+# Copyright 2014 Christopher J. Madsen
#
# Author: Christopher J. Madsen <perl@cjmweb.net>
# Created: 14 Jan 2012
@@ -25,8 +25,8 @@ use Carp 'croak';
use Encode 2.10 qw(decode find_encoding); # need utf-8-strict encoding
use Exporter 5.57 'import';
-our $VERSION = '1.00';
-# This file is part of IO-HTML 1.00 (February 23, 2013)
+our $VERSION = '1.001';
+# This file is part of IO-HTML 1.001 (June 28, 2014)
our $default_encoding ||= 'cp1252';
@@ -155,7 +155,7 @@ sub sniff_encoding
} # end sniff_encoding
#=====================================================================
-# Based on HTML5 8.2.2.1 Determining the character encoding:
+# Based on HTML5 8.2.2.2 Determining the character encoding:
# Get attribute from current position of $_
sub _get_attribute
@@ -264,8 +264,8 @@ IO::HTML - Open an HTML file with automatic charset detection
=head1 VERSION
-This document describes version 1.00 of
-IO::HTML, released February 23, 2013.
+This document describes version 1.001 of
+IO::HTML, released June 28, 2014.
=head1 SYNOPSIS
@@ -284,7 +284,7 @@ IO::HTML, released February 23, 2013.
IO::HTML provides an easy way to open a file containing HTML while
automatically determining its encoding. It uses the HTML5 encoding
-sniffing algorithm specified in section 8.2.2.1 of the draft standard.
+sniffing algorithm specified in section 8.2.2.2 of the draft standard.
The algorithm as implemented here is:
@@ -479,8 +479,8 @@ C<html_file>, C<html_file_and_encoding>, C<html_outfile>.
=head1 SEE ALSO
-The HTML5 specification, section 8.2.2.1 Determining the character encoding:
-L<http://www.w3.org/TR/html5/parsing.html#determining-the-character-encoding>
+The HTML5 specification, section 8.2.2.2 Determining the character encoding:
+L<http://www.w3.org/TR/html5/syntax.html#determining-the-character-encoding>
=head1 DIAGNOSTICS
@@ -540,11 +540,11 @@ or through the web interface at
L<< http://rt.cpan.org/Public/Bug/Report.html?Queue=IO-HTML >>.
You can follow or contribute to IO-HTML's development at
-L<< http://github.com/madsen/io-html >>.
+L<< https://github.com/madsen/io-html >>.
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2013 by Christopher J. Madsen.
+This software is copyright (c) 2014 by Christopher J. Madsen.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Handle.pm b/Master/tlpkg/tlperl/lib/IO/Handle.pm
index 1cfe29e791b..aebf74e4c02 100644
--- a/Master/tlpkg/tlperl/lib/IO/Handle.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Handle.pm
@@ -271,7 +271,7 @@ use IO (); # Load the XS module
require Exporter;
@ISA = qw(Exporter);
-$VERSION = "1.34";
+$VERSION = "1.35";
$VERSION = eval $VERSION;
@EXPORT_OK = qw(
@@ -625,7 +625,7 @@ sub ioctl {
# a sub called constant to determine if a constant existed -- GMB
#
# The SEEK_* and _IO?BF constants were the only constants at that time
-# any new code should just chech defined(&CONSTANT_NAME)
+# any new code should just check defined(&CONSTANT_NAME)
sub constant {
no strict 'refs';
diff --git a/Master/tlpkg/tlperl/lib/IO/Select.pm b/Master/tlpkg/tlperl/lib/IO/Select.pm
index 756a299c348..994f8966ab6 100644
--- a/Master/tlpkg/tlperl/lib/IO/Select.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Select.pm
@@ -11,7 +11,7 @@ use warnings::register;
use vars qw($VERSION @ISA);
require Exporter;
-$VERSION = "1.21";
+$VERSION = "1.22";
@ISA = qw(Exporter); # This is only so we can do version checking
@@ -86,15 +86,24 @@ sub _update
$vec->[$i] = $f;
} else { # remove
if ( ! defined $fn ) { # remove if fileno undef'd
- defined($_) && $_ == $f and do { $vec->[FD_COUNT]--; $_ = undef; }
- for @{$vec}[FIRST_FD .. $#$vec];
- next;
+ $fn = 0;
+ for my $fe (@{$vec}[FIRST_FD .. $#$vec]) {
+ if (defined($fe) && $fe == $f) {
+ $vec->[FD_COUNT]--;
+ $fe = undef;
+ vec($bits, $fn, 1) = 0;
+ last;
+ }
+ ++$fn;
+ }
+ }
+ else {
+ my $i = $fn + FIRST_FD;
+ next unless defined $vec->[$i];
+ $vec->[FD_COUNT]--;
+ vec($bits, $fn, 1) = 0;
+ $vec->[$i] = undef;
}
- my $i = $fn + FIRST_FD;
- next unless defined $vec->[$i];
- $vec->[FD_COUNT]--;
- vec($bits, $fn, 1) = 0;
- $vec->[$i] = undef;
}
$count++;
}
diff --git a/Master/tlpkg/tlperl/lib/IO/Socket.pm b/Master/tlpkg/tlperl/lib/IO/Socket.pm
index aa3c9add78c..c78aeecc1a0 100644
--- a/Master/tlpkg/tlperl/lib/IO/Socket.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Socket.pm
@@ -24,7 +24,7 @@ require IO::Socket::UNIX if ($^O ne 'epoc' && $^O ne 'symbian');
@ISA = qw(IO::Handle);
-$VERSION = "1.36";
+$VERSION = "1.38";
@EXPORT_OK = qw(sockatmark);
@@ -135,11 +135,13 @@ sub connect {
$@ = "connect: timeout";
}
elsif (!connect($sock,$addr) &&
- not ($!{EISCONN} || ($! == 10022 && $^O eq 'MSWin32'))
+ not ($!{EISCONN} || ($^O eq 'MSWin32' &&
+ ($! == (($] < 5.019004) ? 10022 : Errno::EINVAL))))
) {
# Some systems refuse to re-connect() to
# an already open socket and set errno to EISCONN.
- # Windows sets errno to WSAEINVAL (10022)
+ # Windows sets errno to WSAEINVAL (10022) (pre-5.19.4) or
+ # EINVAL (22) (5.19.4 onwards).
$err = $!;
$@ = "connect: $!";
}
@@ -497,8 +499,23 @@ C<use> declaration will fail at compile time.
=item connected
-If the socket is in a connected state the peer address is returned.
-If the socket is not in a connected state then undef will be returned.
+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.
+
+Note that connected() considers a half-open TCP socket to be "in a connected
+state". Specifically, connected() 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
+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.
+
+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.
=item protocol
diff --git a/Master/tlpkg/tlperl/lib/IO/Socket/INET.pm b/Master/tlpkg/tlperl/lib/IO/Socket/INET.pm
index 5af70303d29..7a1694733b5 100644
--- a/Master/tlpkg/tlperl/lib/IO/Socket/INET.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Socket/INET.pm
@@ -15,7 +15,7 @@ use Exporter;
use Errno;
@ISA = qw(IO::Socket);
-$VERSION = "1.33";
+$VERSION = "1.35";
my $EINVAL = exists(&Errno::EINVAL) ? Errno::EINVAL() : 1;
@@ -50,7 +50,7 @@ sub _get_proto_number {
return undef unless defined $name;
return $proto_number{$name} if exists $proto_number{$name};
- my @proto = getprotobyname($name);
+ my @proto = eval { getprotobyname($name) };
return undef unless @proto;
_cache_proto(@proto);
@@ -62,7 +62,7 @@ sub _get_proto_name {
return undef unless defined $num;
return $proto_name{$num} if exists $proto_name{$num};
- my @proto = getprotobynumber($num);
+ my @proto = eval { getprotobynumber($num) };
return undef unless @proto;
_cache_proto(@proto);
@@ -358,7 +358,8 @@ C<IO::Socket::INET> provides.
If C<Listen> is defined then a listen socket is created, else if the
socket type, which is derived from the protocol, is SOCK_STREAM then
-connect() is called.
+connect() is called. If the C<Listen> argument is given, but false,
+the queue size will be set to 5.
Although it is not illegal, the use of C<MultiHomed> on a socket
which is in non-blocking mode is of little use. This is because the
diff --git a/Master/tlpkg/tlperl/lib/IO/Socket/IP.pm b/Master/tlpkg/tlperl/lib/IO/Socket/IP.pm
new file mode 100644
index 00000000000..30e0464d70b
--- /dev/null
+++ b/Master/tlpkg/tlperl/lib/IO/Socket/IP.pm
@@ -0,0 +1,1107 @@
+# You may distribute under the terms of either the GNU General Public License
+# or the Artistic License (the same terms as Perl itself)
+#
+# (C) Paul Evans, 2010-2014 -- leonerd@leonerd.org.uk
+
+package IO::Socket::IP;
+# $VERSION needs to be set before use base 'IO::Socket'
+# - https://rt.cpan.org/Ticket/Display.html?id=92107
+BEGIN {
+ $VERSION = '0.29';
+}
+
+use strict;
+use warnings;
+use base qw( IO::Socket );
+
+use Carp;
+
+use Socket 1.97 qw(
+ getaddrinfo getnameinfo
+ sockaddr_family
+ AF_INET
+ AI_PASSIVE
+ IPPROTO_TCP IPPROTO_UDP
+ IPPROTO_IPV6 IPV6_V6ONLY
+ NI_DGRAM NI_NUMERICHOST NI_NUMERICSERV NIx_NOHOST NIx_NOSERV
+ SO_REUSEADDR SO_REUSEPORT SO_BROADCAST SO_ERROR
+ SOCK_DGRAM SOCK_STREAM
+ SOL_SOCKET
+);
+my $AF_INET6 = eval { Socket::AF_INET6() }; # may not be defined
+my $AI_ADDRCONFIG = eval { Socket::AI_ADDRCONFIG() } || 0;
+use POSIX qw( dup2 );
+use Errno qw( EINVAL EINPROGRESS EISCONN );
+
+use constant HAVE_MSWIN32 => ( $^O eq "MSWin32" );
+
+# At least one OS (Android) is known not to have getprotobyname()
+use constant HAVE_GETPROTOBYNAME => defined eval { getprotobyname( "tcp" ) };
+
+my $IPv6_re = do {
+ # translation of RFC 3986 3.2.2 ABNF to re
+ my $IPv4address = do {
+ my $dec_octet = q<(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])>;
+ qq<$dec_octet(?: \\. $dec_octet){3}>;
+ };
+ my $IPv6address = do {
+ my $h16 = qq<[0-9A-Fa-f]{1,4}>;
+ my $ls32 = qq<(?: $h16 : $h16 | $IPv4address)>;
+ qq<(?:
+ (?: $h16 : ){6} $ls32
+ | :: (?: $h16 : ){5} $ls32
+ | (?: $h16 )? :: (?: $h16 : ){4} $ls32
+ | (?: (?: $h16 : ){0,1} $h16 )? :: (?: $h16 : ){3} $ls32
+ | (?: (?: $h16 : ){0,2} $h16 )? :: (?: $h16 : ){2} $ls32
+ | (?: (?: $h16 : ){0,3} $h16 )? :: $h16 : $ls32
+ | (?: (?: $h16 : ){0,4} $h16 )? :: $ls32
+ | (?: (?: $h16 : ){0,5} $h16 )? :: $h16
+ | (?: (?: $h16 : ){0,6} $h16 )? ::
+ )>
+ };
+ qr<$IPv6address>xo;
+};
+
+=head1 NAME
+
+C<IO::Socket::IP> - Family-neutral IP socket supporting both IPv4 and IPv6
+
+=head1 SYNOPSIS
+
+ use IO::Socket::IP;
+
+ my $sock = IO::Socket::IP->new(
+ PeerHost => "www.google.com",
+ PeerPort => "http",
+ Type => SOCK_STREAM,
+ ) or die "Cannot construct socket - $@";
+
+ my $familyname = ( $sock->sockdomain == PF_INET6 ) ? "IPv6" :
+ ( $sock->sockdomain == PF_INET ) ? "IPv4" :
+ "unknown";
+
+ printf "Connected to google via %s\n", $familyname;
+
+=head1 DESCRIPTION
+
+This module provides a protocol-independent way to use IPv4 and IPv6 sockets,
+intended as a replacement for L<IO::Socket::INET>. Most constructor arguments
+and methods are provided in a backward-compatible way. For a list of known
+differences, see the C<IO::Socket::INET> INCOMPATIBILITES section below.
+
+It uses the C<getaddrinfo(3)> function to convert hostnames and service names
+or port numbers into sets of possible addresses to connect to or listen on.
+This allows it to work for IPv6 where the system supports it, while still
+falling back to IPv4-only on systems which don't.
+
+=head1 REPLACING C<IO::Socket> DEFAULT BEHAVIOUR
+
+By placing C<-register> in the import list, L<IO::Socket> uses
+C<IO::Socket::IP> rather than C<IO::Socket::INET> as the class that handles
+C<PF_INET>. C<IO::Socket> will also use C<IO::Socket::IP> rather than
+C<IO::Socket::INET6> to handle C<PF_INET6>, provided that the C<AF_INET6>
+constant is available.
+
+Changing C<IO::Socket>'s default behaviour means that calling the
+C<IO::Socket> constructor with either C<PF_INET> or C<PF_INET6> as the
+C<Domain> parameter will yield an C<IO::Socket::IP> object.
+
+ use IO::Socket::IP -register;
+
+ my $sock = IO::Socket->new(
+ Domain => PF_INET6,
+ LocalHost => "::1",
+ Listen => 1,
+ ) or die "Cannot create socket - $@\n";
+
+ print "Created a socket of type " . ref($sock) . "\n";
+
+Note that C<-register> is a global setting that applies to the entire program;
+it cannot be applied only for certain callers, removed, or limited by lexical
+scope.
+
+=cut
+
+sub import
+{
+ my $pkg = shift;
+ my @symbols;
+
+ foreach ( @_ ) {
+ if( $_ eq "-register" ) {
+ IO::Socket::IP::_ForINET->register_domain( AF_INET );
+ IO::Socket::IP::_ForINET6->register_domain( $AF_INET6 ) if defined $AF_INET6;
+ }
+ else {
+ push @symbols, $_;
+ }
+ }
+
+ @_ = ( $pkg, @symbols );
+ goto &IO::Socket::import;
+}
+
+# Convenient capability test function
+{
+ my $can_disable_v6only;
+ sub CAN_DISABLE_V6ONLY
+ {
+ return $can_disable_v6only if defined $can_disable_v6only;
+
+ socket my $testsock, Socket::PF_INET6(), SOCK_STREAM, 0 or
+ die "Cannot socket(PF_INET6) - $!";
+
+ if( setsockopt $testsock, IPPROTO_IPV6, IPV6_V6ONLY, 0 ) {
+ return $can_disable_v6only = 1;
+ }
+ elsif( $! == EINVAL ) {
+ return $can_disable_v6only = 0;
+ }
+ else {
+ die "Cannot setsockopt() - $!";
+ }
+ }
+}
+
+=head1 CONSTRUCTORS
+
+=cut
+
+=head2 $sock = IO::Socket::IP->new( %args )
+
+Creates a new C<IO::Socket::IP> object, containing a newly created socket
+handle according to the named arguments passed. The recognised arguments are:
+
+=over 8
+
+=item PeerHost => STRING
+
+=item PeerService => STRING
+
+Hostname and service name for the peer to C<connect()> to. The service name
+may be given as a port number, as a decimal string.
+
+=item PeerAddr => STRING
+
+=item PeerPort => STRING
+
+For symmetry with the accessor methods and compatibility with
+C<IO::Socket::INET>, these are accepted as synonyms for C<PeerHost> and
+C<PeerService> respectively.
+
+=item PeerAddrInfo => ARRAY
+
+Alternate form of specifying the peer to C<connect()> to. This should be an
+array of the form returned by C<Socket::getaddrinfo>.
+
+This parameter takes precedence over the C<Peer*>, C<Family>, C<Type> and
+C<Proto> arguments.
+
+=item LocalHost => STRING
+
+=item LocalService => STRING
+
+Hostname and service name for the local address to C<bind()> to.
+
+=item LocalAddr => STRING
+
+=item LocalPort => STRING
+
+For symmetry with the accessor methods and compatibility with
+C<IO::Socket::INET>, these are accepted as synonyms for C<LocalHost> and
+C<LocalService> respectively.
+
+=item LocalAddrInfo => ARRAY
+
+Alternate form of specifying the local address to C<bind()> to. This should be
+an array of the form returned by C<Socket::getaddrinfo>.
+
+This parameter takes precedence over the C<Local*>, C<Family>, C<Type> and
+C<Proto> arguments.
+
+=item Family => INT
+
+The address family to pass to C<getaddrinfo> (e.g. C<AF_INET>, C<AF_INET6>).
+Normally this will be left undefined, and C<getaddrinfo> will search using any
+address family supported by the system.
+
+=item Type => INT
+
+The socket type to pass to C<getaddrinfo> (e.g. C<SOCK_STREAM>,
+C<SOCK_DGRAM>). Normally defined by the caller; if left undefined
+C<getaddrinfo> may attempt to infer the type from the service name.
+
+=item Proto => STRING or INT
+
+The IP protocol to use for the socket (e.g. C<'tcp'>, C<IPPROTO_TCP>,
+C<'udp'>,C<IPPROTO_UDP>). Normally this will be left undefined, and either
+C<getaddrinfo> or the kernel will choose an appropriate value. May be given
+either in string name or numeric form.
+
+=item GetAddrInfoFlags => INT
+
+More flags to pass to the C<getaddrinfo()> function. If not supplied, a
+default of C<AI_ADDRCONFIG> will be used.
+
+These flags will be combined with C<AI_PASSIVE> if the C<Listen> argument is
+given. For more information see the documentation about C<getaddrinfo()> in
+the L<Socket> module.
+
+=item Listen => INT
+
+If defined, puts the socket into listening mode where new connections can be
+accepted using the C<accept> method. The value given is used as the
+C<listen(2)> queue size.
+
+=item ReuseAddr => BOOL
+
+If true, set the C<SO_REUSEADDR> sockopt
+
+=item ReusePort => BOOL
+
+If true, set the C<SO_REUSEPORT> sockopt (not all OSes implement this sockopt)
+
+=item Broadcast => BOOL
+
+If true, set the C<SO_BROADCAST> sockopt
+
+=item V6Only => BOOL
+
+If defined, set the C<IPV6_V6ONLY> sockopt when creating C<PF_INET6> sockets
+to the given value. If true, a listening-mode socket will only listen on the
+C<AF_INET6> addresses; if false it will also accept connections from
+C<AF_INET> addresses.
+
+If not defined, the socket option will not be changed, and default value set
+by the operating system will apply. For repeatable behaviour across platforms
+it is recommended this value always be defined for listening-mode sockets.
+
+Note that not all platforms support disabling this option. Some, at least
+OpenBSD and MirBSD, will fail with C<EINVAL> if you attempt to disable it.
+To determine whether it is possible to disable, you may use the class method
+
+ if( IO::Socket::IP->CAN_DISABLE_V6ONLY ) {
+ ...
+ }
+ else {
+ ...
+ }
+
+If your platform does not support disabling this option but you still want to
+listen for both C<AF_INET> and C<AF_INET6> connections you will have to create
+two listening sockets, one bound to each protocol.
+
+=item MultiHomed
+
+This C<IO::Socket::INET>-style argument is ignored, except if it is defined
+but false. See the C<IO::Socket::INET> INCOMPATIBILITES section below.
+
+However, the behaviour it enables is always performed by C<IO::Socket::IP>.
+
+=item Blocking => BOOL
+
+If defined but false, the socket will be set to non-blocking mode. Otherwise
+it will default to blocking mode. See the NON-BLOCKING section below for more
+detail.
+
+=back
+
+If neither C<Type> nor C<Proto> hints are provided, a default of
+C<SOCK_STREAM> and C<IPPROTO_TCP> respectively will be set, to maintain
+compatibility with C<IO::Socket::INET>. Other named arguments that are not
+recognised are ignored.
+
+If neither C<Family> nor any hosts or addresses are passed, nor any
+C<*AddrInfo>, then the constructor has no information on which to decide a
+socket family to create. In this case, it performs a C<getaddinfo> call with
+the C<AI_ADDRCONFIG> flag, no host name, and a service name of C<"0">, and
+uses the family of the first returned result.
+
+If the constructor fails, it will set C<$@> to an appropriate error message;
+this may be from C<$!> or it may be some other string; not every failure
+necessarily has an associated C<errno> value.
+
+=head2 $sock = IO::Socket::IP->new( $peeraddr )
+
+As a special case, if the constructor is passed a single argument (as
+opposed to an even-sized list of key/value pairs), it is taken to be the value
+of the C<PeerAddr> parameter. This is parsed in the same way, according to the
+behaviour given in the C<PeerHost> AND C<LocalHost> PARSING section below.
+
+=cut
+
+sub new
+{
+ my $class = shift;
+ my %arg = (@_ == 1) ? (PeerHost => $_[0]) : @_;
+ return $class->SUPER::new(%arg);
+}
+
+# IO::Socket may call this one; neaten up the arguments from IO::Socket::INET
+# before calling our real _configure method
+sub configure
+{
+ my $self = shift;
+ my ( $arg ) = @_;
+
+ $arg->{PeerHost} = delete $arg->{PeerAddr}
+ if exists $arg->{PeerAddr} && !exists $arg->{PeerHost};
+
+ $arg->{PeerService} = delete $arg->{PeerPort}
+ if exists $arg->{PeerPort} && !exists $arg->{PeerService};
+
+ $arg->{LocalHost} = delete $arg->{LocalAddr}
+ if exists $arg->{LocalAddr} && !exists $arg->{LocalHost};
+
+ $arg->{LocalService} = delete $arg->{LocalPort}
+ if exists $arg->{LocalPort} && !exists $arg->{LocalService};
+
+ for my $type (qw(Peer Local)) {
+ my $host = $type . 'Host';
+ my $service = $type . 'Service';
+
+ if( defined $arg->{$host} ) {
+ ( $arg->{$host}, my $s ) = $self->split_addr( $arg->{$host} );
+ # IO::Socket::INET compat - *Host parsed port always takes precedence
+ $arg->{$service} = $s if defined $s;
+ }
+ }
+
+ $self->_io_socket_ip__configure( $arg );
+}
+
+# Avoid simply calling it _configure, as some subclasses of IO::Socket::INET on CPAN already take that
+sub _io_socket_ip__configure
+{
+ my $self = shift;
+ my ( $arg ) = @_;
+
+ my %hints;
+ my @localinfos;
+ my @peerinfos;
+
+ if( defined $arg->{GetAddrInfoFlags} ) {
+ $hints{flags} = $arg->{GetAddrInfoFlags};
+ }
+ else {
+ $hints{flags} = $AI_ADDRCONFIG;
+ }
+
+ if( defined( my $family = $arg->{Family} ) ) {
+ $hints{family} = $family;
+ }
+
+ if( defined( my $type = $arg->{Type} ) ) {
+ $hints{socktype} = $type;
+ }
+
+ if( defined( my $proto = $arg->{Proto} ) ) {
+ unless( $proto =~ m/^\d+$/ ) {
+ my $protonum = HAVE_GETPROTOBYNAME
+ ? getprotobyname( $proto )
+ : eval { Socket->${\"IPPROTO_\U$proto"}() };
+ defined $protonum or croak "Unrecognised protocol $proto";
+ $proto = $protonum;
+ }
+
+ $hints{protocol} = $proto;
+ }
+
+ # To maintain compatibility with IO::Socket::INET, imply a default of
+ # SOCK_STREAM + IPPROTO_TCP if neither hint is given
+ if( !defined $hints{socktype} and !defined $hints{protocol} ) {
+ $hints{socktype} = SOCK_STREAM;
+ $hints{protocol} = IPPROTO_TCP;
+ }
+
+ # Some OSes (NetBSD) don't seem to like just a protocol hint without a
+ # socktype hint as well. We'll set a couple of common ones
+ if( !defined $hints{socktype} and defined $hints{protocol} ) {
+ $hints{socktype} = SOCK_STREAM if $hints{protocol} == IPPROTO_TCP;
+ $hints{socktype} = SOCK_DGRAM if $hints{protocol} == IPPROTO_UDP;
+ }
+
+ if( my $info = $arg->{LocalAddrInfo} ) {
+ ref $info eq "ARRAY" or croak "Expected 'LocalAddrInfo' to be an ARRAY ref";
+ @localinfos = @$info;
+ }
+ elsif( defined $arg->{LocalHost} or defined $arg->{LocalService} ) {
+ # Either may be undef
+ my $host = $arg->{LocalHost};
+ my $service = $arg->{LocalService};
+
+ local $1; # Placate a taint-related bug; [perl #67962]
+ defined $service and $service =~ s/\((\d+)\)$// and
+ my $fallback_port = $1;
+
+ my %localhints = %hints;
+ $localhints{flags} |= AI_PASSIVE;
+ ( my $err, @localinfos ) = getaddrinfo( $host, $service, \%localhints );
+
+ if( $err and defined $fallback_port ) {
+ ( $err, @localinfos ) = getaddrinfo( $host, $fallback_port, \%localhints );
+ }
+
+ if( $err ) {
+ $@ = "$err";
+ $! = EINVAL;
+ return;
+ }
+ }
+
+ if( my $info = $arg->{PeerAddrInfo} ) {
+ ref $info eq "ARRAY" or croak "Expected 'PeerAddrInfo' to be an ARRAY ref";
+ @peerinfos = @$info;
+ }
+ elsif( defined $arg->{PeerHost} or defined $arg->{PeerService} ) {
+ defined( my $host = $arg->{PeerHost} ) or
+ croak "Expected 'PeerHost'";
+ defined( my $service = $arg->{PeerService} ) or
+ croak "Expected 'PeerService'";
+
+ local $1; # Placate a taint-related bug; [perl #67962]
+ defined $service and $service =~ s/\((\d+)\)$// and
+ my $fallback_port = $1;
+
+ ( my $err, @peerinfos ) = getaddrinfo( $host, $service, \%hints );
+
+ if( $err and defined $fallback_port ) {
+ ( $err, @peerinfos ) = getaddrinfo( $host, $fallback_port, \%hints );
+ }
+
+ if( $err ) {
+ $@ = "$err";
+ $! = EINVAL;
+ return;
+ }
+ }
+
+ my @sockopts_enabled;
+ push @sockopts_enabled, SO_REUSEADDR if $arg->{ReuseAddr};
+ push @sockopts_enabled, SO_REUSEPORT if $arg->{ReusePort};
+ push @sockopts_enabled, SO_BROADCAST if $arg->{Broadcast};
+
+ my $listenqueue = $arg->{Listen};
+
+ croak "Cannot Listen with a PeerHost" if defined $listenqueue and @peerinfos;
+
+ my $blocking = $arg->{Blocking};
+ defined $blocking or $blocking = 1;
+
+ my $v6only = $arg->{V6Only};
+
+ # IO::Socket::INET defines this key. IO::Socket::IP always implements the
+ # behaviour it requests, so we can ignore it, unless the caller is for some
+ # reason asking to disable it.
+ if( defined $arg->{MultiHomed} and !$arg->{MultiHomed} ) {
+ croak "Cannot disable the MultiHomed parameter";
+ }
+
+ my @infos;
+ foreach my $local ( @localinfos ? @localinfos : {} ) {
+ foreach my $peer ( @peerinfos ? @peerinfos : {} ) {
+ next if defined $local->{family} and defined $peer->{family} and
+ $local->{family} != $peer->{family};
+ next if defined $local->{socktype} and defined $peer->{socktype} and
+ $local->{socktype} != $peer->{socktype};
+ next if defined $local->{protocol} and defined $peer->{protocol} and
+ $local->{protocol} != $peer->{protocol};
+
+ my $family = $local->{family} || $peer->{family} or next;
+ my $socktype = $local->{socktype} || $peer->{socktype} or next;
+ my $protocol = $local->{protocol} || $peer->{protocol} || 0;
+
+ push @infos, {
+ family => $family,
+ socktype => $socktype,
+ protocol => $protocol,
+ localaddr => $local->{addr},
+ peeraddr => $peer->{addr},
+ };
+ }
+ }
+
+ if( !@infos ) {
+ # If there was a Family hint then create a plain unbound, unconnected socket
+ if( defined $hints{family} ) {
+ @infos = ( {
+ family => $hints{family},
+ socktype => $hints{socktype},
+ protocol => $hints{protocol},
+ } );
+ }
+ # If there wasn't, use getaddrinfo()'s AI_ADDRCONFIG side-effect to guess a
+ # suitable family first.
+ else {
+ ( my $err, @infos ) = getaddrinfo( "", "0", \%hints );
+ if( $err ) {
+ $@ = "$err";
+ $! = EINVAL;
+ return;
+ }
+
+ # We'll take all the @infos anyway, because some OSes (HPUX) are known to
+ # ignore the AI_ADDRCONFIG hint and return AF_INET6 even if they don't
+ # support them
+ }
+ }
+
+ # In the nonblocking case, caller will be calling ->setup multiple times.
+ # Store configuration in the object for the ->setup method
+ # Yes, these are messy. Sorry, I can't help that...
+
+ ${*$self}{io_socket_ip_infos} = \@infos;
+
+ ${*$self}{io_socket_ip_idx} = -1;
+
+ ${*$self}{io_socket_ip_sockopts} = \@sockopts_enabled;
+ ${*$self}{io_socket_ip_v6only} = $v6only;
+ ${*$self}{io_socket_ip_listenqueue} = $listenqueue;
+ ${*$self}{io_socket_ip_blocking} = $blocking;
+
+ ${*$self}{io_socket_ip_errors} = [ undef, undef, undef ];
+
+ # ->setup is allowed to return false in nonblocking mode
+ $self->setup or !$blocking or return undef;
+
+ return $self;
+}
+
+sub setup
+{
+ my $self = shift;
+
+ while(1) {
+ ${*$self}{io_socket_ip_idx}++;
+ last if ${*$self}{io_socket_ip_idx} >= @{ ${*$self}{io_socket_ip_infos} };
+
+ my $info = ${*$self}{io_socket_ip_infos}->[${*$self}{io_socket_ip_idx}];
+
+ $self->socket( @{$info}{qw( family socktype protocol )} ) or
+ ( ${*$self}{io_socket_ip_errors}[2] = $!, next );
+
+ $self->blocking( 0 ) unless ${*$self}{io_socket_ip_blocking};
+
+ foreach my $sockopt ( @{ ${*$self}{io_socket_ip_sockopts} } ) {
+ $self->setsockopt( SOL_SOCKET, $sockopt, pack "i", 1 ) or ( $@ = "$!", return undef );
+ }
+
+ if( defined ${*$self}{io_socket_ip_v6only} and defined $AF_INET6 and $info->{family} == $AF_INET6 ) {
+ my $v6only = ${*$self}{io_socket_ip_v6only};
+ $self->setsockopt( IPPROTO_IPV6, IPV6_V6ONLY, pack "i", $v6only ) or ( $@ = "$!", return undef );
+ }
+
+ if( defined( my $addr = $info->{localaddr} ) ) {
+ $self->bind( $addr ) or
+ ( ${*$self}{io_socket_ip_errors}[1] = $!, next );
+ }
+
+ if( defined( my $listenqueue = ${*$self}{io_socket_ip_listenqueue} ) ) {
+ $self->listen( $listenqueue ) or ( $@ = "$!", return undef );
+ }
+
+ if( defined( my $addr = $info->{peeraddr} ) ) {
+ if( $self->connect( $addr ) ) {
+ $! = 0;
+ return 1;
+ }
+
+ if( $! == EINPROGRESS or HAVE_MSWIN32 && $! == Errno::EWOULDBLOCK() ) {
+ ${*$self}{io_socket_ip_connect_in_progress} = 1;
+ return 0;
+ }
+
+ ${*$self}{io_socket_ip_errors}[0] = $!;
+ next;
+ }
+
+ return 1;
+ }
+
+ # Pick the most appropriate error, stringified
+ $! = ( grep defined, @{ ${*$self}{io_socket_ip_errors}} )[0];
+ $@ = "$!";
+ return undef;
+}
+
+sub connect
+{
+ my $self = shift;
+
+ # It seems that IO::Socket hides EINPROGRESS errors, making them look like
+ # a success. This is annoying here.
+ # Instead of putting up with its frankly-irritating intentional breakage of
+ # useful APIs I'm just going to end-run around it and call CORE::connect()
+ # directly
+
+ return CORE::connect( $self, $_[0] ) if @_;
+
+ return 1 if !${*$self}{io_socket_ip_connect_in_progress};
+
+ # See if a connect attempt has just failed with an error
+ if( my $errno = $self->getsockopt( SOL_SOCKET, SO_ERROR ) ) {
+ delete ${*$self}{io_socket_ip_connect_in_progress};
+ ${*$self}{io_socket_ip_errors}[0] = $! = $errno;
+ return $self->setup;
+ }
+
+ # No error, so either connect is still in progress, or has completed
+ # successfully. We can tell by trying to connect() again; either it will
+ # succeed or we'll get EISCONN (connected successfully), or EALREADY
+ # (still in progress). This even works on MSWin32.
+ my $addr = ${*$self}{io_socket_ip_infos}[${*$self}{io_socket_ip_idx}]{peeraddr};
+
+ if( $self->connect( $addr ) or $! == EISCONN ) {
+ delete ${*$self}{io_socket_ip_connect_in_progress};
+ $! = 0;
+ return 1;
+ }
+ else {
+ $! = EINPROGRESS;
+ return 0;
+ }
+}
+
+sub connected
+{
+ my $self = shift;
+ return defined $self->fileno &&
+ !${*$self}{io_socket_ip_connect_in_progress} &&
+ defined getpeername( $self ); # ->peername caches, we need to detect disconnection
+}
+
+=head1 METHODS
+
+As well as the following methods, this class inherits all the methods in
+L<IO::Socket> and L<IO::Handle>.
+
+=cut
+
+sub _get_host_service
+{
+ my $self = shift;
+ my ( $addr, $flags, $xflags ) = @_;
+
+ $flags |= NI_DGRAM if $self->socktype == SOCK_DGRAM;
+
+ my ( $err, $host, $service ) = getnameinfo( $addr, $flags, $xflags || 0 );
+ croak "getnameinfo - $err" if $err;
+
+ return ( $host, $service );
+}
+
+sub _unpack_sockaddr
+{
+ my ( $addr ) = @_;
+ my $family = sockaddr_family $addr;
+
+ if( $family == AF_INET ) {
+ return ( Socket::unpack_sockaddr_in( $addr ) )[1];
+ }
+ elsif( defined $AF_INET6 and $family == $AF_INET6 ) {
+ return ( Socket::unpack_sockaddr_in6( $addr ) )[1];
+ }
+ else {
+ croak "Unrecognised address family $family";
+ }
+}
+
+=head2 ( $host, $service ) = $sock->sockhost_service( $numeric )
+
+Returns the hostname and service name of the local address (that is, the
+socket address given by the C<sockname> method).
+
+If C<$numeric> is true, these will be given in numeric form rather than being
+resolved into names.
+
+The following four convenience wrappers may be used to obtain one of the two
+values returned here. If both host and service names are required, this method
+is preferable to the following wrappers, because it will call
+C<getnameinfo(3)> only once.
+
+=cut
+
+sub sockhost_service
+{
+ my $self = shift;
+ my ( $numeric ) = @_;
+
+ $self->_get_host_service( $self->sockname, $numeric ? NI_NUMERICHOST|NI_NUMERICSERV : 0 );
+}
+
+=head2 $addr = $sock->sockhost
+
+Return the numeric form of the local address as a textual representation
+
+=head2 $port = $sock->sockport
+
+Return the numeric form of the local port number
+
+=head2 $host = $sock->sockhostname
+
+Return the resolved name of the local address
+
+=head2 $service = $sock->sockservice
+
+Return the resolved name of the local port number
+
+=cut
+
+sub sockhost { my $self = shift; ( $self->_get_host_service( $self->sockname, NI_NUMERICHOST, NIx_NOSERV ) )[0] }
+sub sockport { my $self = shift; ( $self->_get_host_service( $self->sockname, NI_NUMERICSERV, NIx_NOHOST ) )[1] }
+
+sub sockhostname { my $self = shift; ( $self->_get_host_service( $self->sockname, 0, NIx_NOSERV ) )[0] }
+sub sockservice { my $self = shift; ( $self->_get_host_service( $self->sockname, 0, NIx_NOHOST ) )[1] }
+
+=head2 $addr = $sock->sockaddr
+
+Return the local address as a binary octet string
+
+=cut
+
+sub sockaddr { my $self = shift; _unpack_sockaddr $self->sockname }
+
+=head2 ( $host, $service ) = $sock->peerhost_service( $numeric )
+
+Returns the hostname and service name of the peer address (that is, the
+socket address given by the C<peername> method), similar to the
+C<sockhost_service> method.
+
+The following four convenience wrappers may be used to obtain one of the two
+values returned here. If both host and service names are required, this method
+is preferable to the following wrappers, because it will call
+C<getnameinfo(3)> only once.
+
+=cut
+
+sub peerhost_service
+{
+ my $self = shift;
+ my ( $numeric ) = @_;
+
+ $self->_get_host_service( $self->peername, $numeric ? NI_NUMERICHOST|NI_NUMERICSERV : 0 );
+}
+
+=head2 $addr = $sock->peerhost
+
+Return the numeric form of the peer address as a textual representation
+
+=head2 $port = $sock->peerport
+
+Return the numeric form of the peer port number
+
+=head2 $host = $sock->peerhostname
+
+Return the resolved name of the peer address
+
+=head2 $service = $sock->peerservice
+
+Return the resolved name of the peer port number
+
+=cut
+
+sub peerhost { my $self = shift; ( $self->_get_host_service( $self->peername, NI_NUMERICHOST, NIx_NOSERV ) )[0] }
+sub peerport { my $self = shift; ( $self->_get_host_service( $self->peername, NI_NUMERICSERV, NIx_NOHOST ) )[1] }
+
+sub peerhostname { my $self = shift; ( $self->_get_host_service( $self->peername, 0, NIx_NOSERV ) )[0] }
+sub peerservice { my $self = shift; ( $self->_get_host_service( $self->peername, 0, NIx_NOHOST ) )[1] }
+
+=head2 $addr = $peer->peeraddr
+
+Return the peer address as a binary octet string
+
+=cut
+
+sub peeraddr { my $self = shift; _unpack_sockaddr $self->peername }
+
+# This unbelievably dodgy hack works around the bug that IO::Socket doesn't do
+# it
+# https://rt.cpan.org/Ticket/Display.html?id=61577
+sub accept
+{
+ my $self = shift;
+ my ( $new, $peer ) = $self->SUPER::accept( @_ ) or return;
+
+ ${*$new}{$_} = ${*$self}{$_} for qw( io_socket_domain io_socket_type io_socket_proto );
+
+ return wantarray ? ( $new, $peer )
+ : $new;
+}
+
+# This second unbelievably dodgy hack guarantees that $self->fileno doesn't
+# change, which is useful during nonblocking connect
+sub socket
+{
+ my $self = shift;
+ return $self->SUPER::socket(@_) if not defined $self->fileno;
+
+ # I hate core prototypes sometimes...
+ CORE::socket( my $tmph, $_[0], $_[1], $_[2] ) or return undef;
+
+ dup2( $tmph->fileno, $self->fileno ) or die "Unable to dup2 $tmph onto $self - $!";
+}
+
+# Versions of IO::Socket before 1.35 may leave socktype undef if from, say, an
+# ->fdopen call. In this case we'll apply a fix
+BEGIN {
+ if( $IO::Socket::VERSION < 1.35 ) {
+ *socktype = sub {
+ my $self = shift;
+ my $type = $self->SUPER::socktype;
+ if( !defined $type ) {
+ $type = $self->sockopt( Socket::SO_TYPE() );
+ }
+ return $type;
+ };
+ }
+}
+
+=head2 $inet = $sock->as_inet
+
+Returns a new L<IO::Socket::INET> instance wrapping the same filehandle. This
+may be useful in cases where it is required, for backward-compatibility, to
+have a real object of C<IO::Socket::INET> type instead of C<IO::Socket::IP>.
+The new object will wrap the same underlying socket filehandle as the
+original, so care should be taken not to continue to use both objects
+concurrently. Ideally the original C<$sock> should be discarded after this
+method is called.
+
+This method checks that the socket domain is C<PF_INET> and will throw an
+exception if it isn't.
+
+=cut
+
+sub as_inet
+{
+ my $self = shift;
+ croak "Cannot downgrade a non-PF_INET socket to IO::Socket::INET" unless $self->sockdomain == AF_INET;
+ return IO::Socket::INET->new_from_fd( $self->fileno, "r+" );
+}
+
+=head1 NON-BLOCKING
+
+If the constructor is passed a defined but false value for the C<Blocking>
+argument then the socket is put into non-blocking mode. When in non-blocking
+mode, the socket will not be set up by the time the constructor returns,
+because the underlying C<connect(2)> syscall would otherwise have to block.
+
+The non-blocking behaviour is an extension of the C<IO::Socket::INET> API,
+unique to C<IO::Socket::IP>, because the former does not support multi-homed
+non-blocking connect.
+
+When using non-blocking mode, the caller must repeatedly check for
+writeability on the filehandle (for instance using C<select> or C<IO::Poll>).
+Each time the filehandle is ready to write, the C<connect> method must be
+called, with no arguments. Note that some operating systems, most notably
+C<MSWin32> do not report a C<connect()> failure using write-ready; so you must
+also C<select()> for exceptional status.
+
+While C<connect> returns false, the value of C<$!> indicates whether it should
+be tried again (by being set to the value C<EINPROGRESS>, or C<EWOULDBLOCK> on
+MSWin32), or whether a permanent error has occurred (e.g. C<ECONNREFUSED>).
+
+Once the socket has been connected to the peer, C<connect> will return true
+and the socket will now be ready to use.
+
+Note that calls to the platform's underlying C<getaddrinfo(3)> function may
+block. If C<IO::Socket::IP> has to perform this lookup, the constructor will
+block even when in non-blocking mode.
+
+To avoid this blocking behaviour, the caller should pass in the result of such
+a lookup using the C<PeerAddrInfo> or C<LocalAddrInfo> arguments. This can be
+achieved by using L<Net::LibAsyncNS>, or the C<getaddrinfo(3)> function can be
+called in a child process.
+
+ use IO::Socket::IP;
+ use Errno qw( EINPROGRESS EWOULDBLOCK );
+
+ my @peeraddrinfo = ... # Caller must obtain the getaddinfo result here
+
+ my $socket = IO::Socket::IP->new(
+ PeerAddrInfo => \@peeraddrinfo,
+ Blocking => 0,
+ ) or die "Cannot construct socket - $@";
+
+ while( !$socket->connect and ( $! == EINPROGRESS || $! == EWOULDBLOCK ) ) {
+ my $wvec = '';
+ vec( $wvec, fileno $socket, 1 ) = 1;
+ my $evec = '';
+ vec( $evec, fileno $socket, 1 ) = 1;
+
+ select( undef, $wvec, $evec, undef ) or die "Cannot select - $!";
+ }
+
+ die "Cannot connect - $!" if $!;
+
+ ...
+
+The example above uses C<select()>, but any similar mechanism should work
+analogously. C<IO::Socket::IP> takes care when creating new socket filehandles
+to preserve the actual file descriptor number, so such techniques as C<poll>
+or C<epoll> should be transparent to its reallocation of a different socket
+underneath, perhaps in order to switch protocol family between C<PF_INET> and
+C<PF_INET6>.
+
+For another example using C<IO::Poll> and C<Net::LibAsyncNS>, see the
+F<examples/nonblocking_libasyncns.pl> file in the module distribution.
+
+=cut
+
+=head1 C<PeerHost> AND C<LocalHost> PARSING
+
+To support the C<IO::Socket::INET> API, the host and port information may be
+passed in a single string rather than as two separate arguments.
+
+If either C<LocalHost> or C<PeerHost> (or their C<...Addr> synonyms) have any
+of the following special forms then special parsing is applied.
+
+The value of the C<...Host> argument will be split to give both the hostname
+and port (or service name):
+
+ hostname.example.org:http # Host name
+ 192.0.2.1:80 # IPv4 address
+ [2001:db8::1]:80 # IPv6 address
+
+In each case, the port or service name (e.g. C<80>) is passed as the
+C<LocalService> or C<PeerService> argument.
+
+Either of C<LocalService> or C<PeerService> (or their C<...Port> synonyms) can
+be either a service name, a decimal number, or a string containing both a
+service name and number, in a form such as
+
+ http(80)
+
+In this case, the name (C<http>) will be tried first, but if the resolver does
+not understand it then the port number (C<80>) will be used instead.
+
+If the C<...Host> argument is in this special form and the corresponding
+C<...Service> or C<...Port> argument is also defined, the one parsed from
+the C<...Host> argument will take precedence and the other will be ignored.
+
+=head2 ( $host, $port ) = IO::Socket::IP->split_addr( $addr )
+
+Utility method that provides the parsing functionality described above.
+Returns a 2-element list, containing either the split hostname and port
+description if it could be parsed, or the given address and C<undef> if it was
+not recognised.
+
+ IO::Socket::IP->split_addr( "hostname:http" )
+ # ( "hostname", "http" )
+
+ IO::Socket::IP->split_addr( "192.0.2.1:80" )
+ # ( "192.0.2.1", "80" )
+
+ IO::Socket::IP->split_addr( "[2001:db8::1]:80" )
+ # ( "2001:db8::1", "80" )
+
+ IO::Socket::IP->split_addr( "something.else" )
+ # ( "something.else", undef )
+
+=cut
+
+sub split_addr
+{
+ shift;
+ my ( $addr ) = @_;
+
+ local ( $1, $2 ); # Placate a taint-related bug; [perl #67962]
+ if( $addr =~ m/\A\[($IPv6_re)\](?::([^\s:]*))?\z/ or
+ $addr =~ m/\A([^\s:]*):([^\s:]*)\z/ ) {
+ return ( $1, $2 ) if defined $2 and length $2;
+ return ( $1, undef );
+ }
+
+ return ( $addr, undef );
+}
+
+=head2 $addr = IO::Socket::IP->join_addr( $host, $port )
+
+Utility method that performs the reverse of C<split_addr>, returning a string
+formed by joining the specified host address and port number. The host address
+will be wrapped in C<[]> brackets if required (because it is a raw IPv6
+numeric address).
+
+This can be especially useful when combined with the C<sockhost_service> or
+C<peerhost_service> methods.
+
+ say "Connected to ", IO::Socket::IP->join_addr( $sock->peerhost_service );
+
+=cut
+
+sub join_addr
+{
+ shift;
+ my ( $host, $port ) = @_;
+
+ $host = "[$host]" if $host =~ m/:/;
+
+ return join ":", $host, $port if defined $port;
+ return $host;
+}
+
+# Since IO::Socket->new( Domain => ... ) will delete the Domain parameter
+# before calling ->configure, we need to keep track of which it was
+
+package # hide from indexer
+ IO::Socket::IP::_ForINET;
+use base qw( IO::Socket::IP );
+
+sub configure
+{
+ # This is evil
+ my $self = shift;
+ my ( $arg ) = @_;
+
+ bless $self, "IO::Socket::IP";
+ $self->configure( { %$arg, Family => Socket::AF_INET() } );
+}
+
+package # hide from indexer
+ IO::Socket::IP::_ForINET6;
+use base qw( IO::Socket::IP );
+
+sub configure
+{
+ # This is evil
+ my $self = shift;
+ my ( $arg ) = @_;
+
+ bless $self, "IO::Socket::IP";
+ $self->configure( { %$arg, Family => Socket::AF_INET6() } );
+}
+
+=head1 C<IO::Socket::INET> INCOMPATIBILITES
+
+=over 4
+
+=item *
+
+The behaviour enabled by C<MultiHomed> is in fact implemented by
+C<IO::Socket::IP> as it is required to correctly support searching for a
+useable address from the results of the C<getaddrinfo(3)> call. The
+constructor will ignore the value of this argument, except if it is defined
+but false. An exception is thrown in this case, because that would request it
+disable the C<getaddrinfo(3)> search behaviour in the first place.
+
+=back
+
+=cut
+
+=head1 TODO
+
+=over 4
+
+=item *
+
+Investigate whether C<POSIX::dup2> upsets BSD's C<kqueue> watchers, and if so,
+consider what possible workarounds might be applied.
+
+=back
+
+=head1 AUTHOR
+
+Paul Evans <leonerd@leonerd.org.uk>
+
+=cut
+
+0x55AA;
diff --git a/Master/tlpkg/tlperl/lib/IO/Socket/UNIX.pm b/Master/tlpkg/tlperl/lib/IO/Socket/UNIX.pm
index c6a10fea805..30b8f74eb05 100644
--- a/Master/tlpkg/tlperl/lib/IO/Socket/UNIX.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Socket/UNIX.pm
@@ -12,7 +12,7 @@ use IO::Socket;
use Carp;
@ISA = qw(IO::Socket);
-$VERSION = "1.24";
+$VERSION = "1.26";
$VERSION = eval $VERSION;
IO::Socket::UNIX->register_domain( AF_UNIX );
@@ -74,6 +74,28 @@ IO::Socket::UNIX - Object interface for AF_UNIX domain sockets
use IO::Socket::UNIX;
+ my $SOCK_PATH = "$ENV{HOME}/unix-domain-socket-test.sock";
+
+ # Server:
+ my $server = IO::Socket::UNIX->new(
+ Type => SOCK_STREAM(),
+ Local => $SOCK_PATH,
+ Listen => 1,
+ );
+
+ my $count = 1;
+ while (my $conn = $server->accept()) {
+ $conn->print("Hello " . ($count++) . "\n");
+ }
+
+ # Client:
+ my $client = IO::Socket::UNIX->new(
+ Type => SOCK_STREAM(),
+ Peer => $SOCK_PATH,
+ );
+
+ # Now read and write from $client
+
=head1 DESCRIPTION
C<IO::Socket::UNIX> provides an object interface to creating and using sockets
@@ -96,18 +118,12 @@ C<IO::Socket::UNIX> provides.
Type Type of socket (eg SOCK_STREAM or SOCK_DGRAM)
Local Path to local fifo
Peer Path to peer fifo
- Listen Create a listen socket
+ Listen Queue size for listen
If the constructor is only passed a single argument, it is assumed to
be a C<Peer> specification.
-
- NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
-
-As of VERSION 1.18 all IO::Socket objects have autoflush turned on
-by default. This was not the case with earlier releases.
-
- NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+If the C<Listen> argument is given, but false, the queue size will be set to 5.
=back
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm
index c35601cd3d2..53b8ef1d583 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Bunzip2.pm
@@ -4,12 +4,12 @@ use strict;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.060 qw(:Status);
+use IO::Compress::Base::Common 2.064 qw(:Status);
-use Compress::Raw::Bzip2 2.060 ;
+use Compress::Raw::Bzip2 2.064 ;
our ($VERSION, @ISA);
-$VERSION = '2.060';
+$VERSION = '2.064';
sub mkUncompObject
{
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm
index 5c63b5ccbd2..812f3f87d1b 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Identity.pm
@@ -4,14 +4,14 @@ use warnings;
use strict;
use bytes;
-use IO::Compress::Base::Common 2.060 qw(:Status);
+use IO::Compress::Base::Common 2.064 qw(:Status);
use IO::Compress::Zip::Constants ;
our ($VERSION);
-$VERSION = '2.060';
+$VERSION = '2.064';
-use Compress::Raw::Zlib 2.060 ();
+use Compress::Raw::Zlib 2.064 ();
sub mkUncompObject
{
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm
index 5d8e1a326d3..68beea145c9 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Adapter/Inflate.pm
@@ -4,11 +4,11 @@ use strict;
use warnings;
#use bytes;
-use IO::Compress::Base::Common 2.060 qw(:Status);
-use Compress::Raw::Zlib 2.060 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
+use IO::Compress::Base::Common 2.064 qw(:Status);
+use Compress::Raw::Zlib 2.064 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
our ($VERSION);
-$VERSION = '2.060';
+$VERSION = '2.064';
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm
index 14c695f0d44..cdf229a252a 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyInflate.pm
@@ -6,22 +6,22 @@ use strict;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.060 ();
+use IO::Compress::Base::Common 2.064 ();
-use IO::Uncompress::Adapter::Inflate 2.060 ();
+use IO::Uncompress::Adapter::Inflate 2.064 ();
-use IO::Uncompress::Base 2.060 ;
-use IO::Uncompress::Gunzip 2.060 ;
-use IO::Uncompress::Inflate 2.060 ;
-use IO::Uncompress::RawInflate 2.060 ;
-use IO::Uncompress::Unzip 2.060 ;
+use IO::Uncompress::Base 2.064 ;
+use IO::Uncompress::Gunzip 2.064 ;
+use IO::Uncompress::Inflate 2.064 ;
+use IO::Uncompress::RawInflate 2.064 ;
+use IO::Uncompress::Unzip 2.064 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError);
-$VERSION = '2.060';
+$VERSION = '2.064';
$AnyInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
@@ -48,7 +48,7 @@ sub anyinflate
sub getExtraParams
{
- use IO::Compress::Base::Common 2.060 qw(:Parse);
+ use IO::Compress::Base::Common 2.064 qw(:Parse);
return ( 'rawinflate' => [Parse_boolean, 0] ) ;
}
@@ -210,7 +210,7 @@ section.
The functional interface needs Perl5.005 or better.
-=head2 anyinflate $input => $output [, OPTS]
+=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>.
@@ -704,7 +704,7 @@ Usage is
$status = $z->read($buffer)
-Reads a block of compressed data (the size the the compressed block is
+Reads a block of compressed data (the size of the compressed block is
determined by the C<Buffer> option in the constructor), uncompresses it and
writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
set in the constructor, the uncompressed data will be appended to the
@@ -742,7 +742,7 @@ Usage is
Reads a single line.
-This method fully supports the use of of the variable C<$/> (or
+This method fully supports the use of the variable C<$/> (or
C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
determine what constitutes an end of line. Paragraph mode, record mode and
file slurp mode are all supported.
@@ -810,7 +810,7 @@ It is a fatal error to attempt to seek backward.
Note that the implementation of C<seek> in this module does not provide
true random access to a compressed file/buffer. It works by uncompressing
data from the current offset in the file/buffer until it reaches the
-ucompressed offset specified in the parameters to C<seek>. For very small
+uncompressed offset specified in the parameters to C<seek>. For very small
files this may be acceptable behaviour. For large files it may cause an
unacceptable delay.
@@ -859,7 +859,7 @@ Returns the current uncompressed line number. If C<EXPR> is present it has
the effect of setting the line number. Note that setting the line number
does not change the current position within the file/buffer being read.
-The contents of C<$/> are used to to determine what constitutes a line
+The contents of C<$/> are used to determine what constitutes a line
terminator.
=head2 fileno
@@ -995,7 +995,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm
index a202763c0a5..e2b104dff43 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/AnyUncompress.pm
@@ -4,16 +4,16 @@ use strict;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.060 ();
+use IO::Compress::Base::Common 2.064 ();
-use IO::Uncompress::Base 2.060 ;
+use IO::Uncompress::Base 2.064 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError);
-$VERSION = '2.060';
+$VERSION = '2.064';
$AnyUncompressError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
@@ -27,22 +27,22 @@ Exporter::export_ok_tags('all');
BEGIN
{
- eval ' use IO::Uncompress::Adapter::Inflate 2.060 ;';
- eval ' use IO::Uncompress::Adapter::Bunzip2 2.060 ;';
- eval ' use IO::Uncompress::Adapter::LZO 2.060 ;';
- eval ' use IO::Uncompress::Adapter::Lzf 2.060 ;';
- eval ' use IO::Uncompress::Adapter::UnLzma 2.060 ;';
- eval ' use IO::Uncompress::Adapter::UnXz 2.060 ;';
-
- eval ' use IO::Uncompress::Bunzip2 2.060 ;';
- eval ' use IO::Uncompress::UnLzop 2.060 ;';
- eval ' use IO::Uncompress::Gunzip 2.060 ;';
- eval ' use IO::Uncompress::Inflate 2.060 ;';
- eval ' use IO::Uncompress::RawInflate 2.060 ;';
- eval ' use IO::Uncompress::Unzip 2.060 ;';
- eval ' use IO::Uncompress::UnLzf 2.060 ;';
- eval ' use IO::Uncompress::UnLzma 2.060 ;';
- eval ' use IO::Uncompress::UnXz 2.060 ;';
+ eval ' use IO::Uncompress::Adapter::Inflate 2.064 ;';
+ eval ' use IO::Uncompress::Adapter::Bunzip2 2.064 ;';
+ eval ' use IO::Uncompress::Adapter::LZO 2.064 ;';
+ eval ' use IO::Uncompress::Adapter::Lzf 2.064 ;';
+ eval ' use IO::Uncompress::Adapter::UnLzma 2.064 ;';
+ eval ' use IO::Uncompress::Adapter::UnXz 2.064 ;';
+
+ eval ' use IO::Uncompress::Bunzip2 2.064 ;';
+ eval ' use IO::Uncompress::UnLzop 2.064 ;';
+ eval ' use IO::Uncompress::Gunzip 2.064 ;';
+ eval ' use IO::Uncompress::Inflate 2.064 ;';
+ eval ' use IO::Uncompress::RawInflate 2.064 ;';
+ eval ' use IO::Uncompress::Unzip 2.064 ;';
+ eval ' use IO::Uncompress::UnLzf 2.064 ;';
+ eval ' use IO::Uncompress::UnLzma 2.064 ;';
+ eval ' use IO::Uncompress::UnXz 2.064 ;';
}
sub new
@@ -318,7 +318,7 @@ section.
The functional interface needs Perl5.005 or better.
-=head2 anyuncompress $input => $output [, OPTS]
+=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>.
@@ -759,7 +759,7 @@ Usage is
$status = $z->read($buffer)
-Reads a block of compressed data (the size the the compressed block is
+Reads a block of compressed data (the size of the compressed block is
determined by the C<Buffer> option in the constructor), uncompresses it and
writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
set in the constructor, the uncompressed data will be appended to the
@@ -797,7 +797,7 @@ Usage is
Reads a single line.
-This method fully supports the use of of the variable C<$/> (or
+This method fully supports the use of the variable C<$/> (or
C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
determine what constitutes an end of line. Paragraph mode, record mode and
file slurp mode are all supported.
@@ -857,7 +857,7 @@ It is a fatal error to attempt to seek backward.
Note that the implementation of C<seek> in this module does not provide
true random access to a compressed file/buffer. It works by uncompressing
data from the current offset in the file/buffer until it reaches the
-ucompressed offset specified in the parameters to C<seek>. For very small
+uncompressed offset specified in the parameters to C<seek>. For very small
files this may be acceptable behaviour. For large files it may cause an
unacceptable delay.
@@ -906,7 +906,7 @@ Returns the current uncompressed line number. If C<EXPR> is present it has
the effect of setting the line number. Note that setting the line number
does not change the current position within the file/buffer being read.
-The contents of C<$/> are used to to determine what constitutes a line
+The contents of C<$/> are used to determine what constitutes a line
terminator.
=head2 fileno
@@ -1025,7 +1025,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm
index 5d6336b9473..4d1b7802850 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Base.pm
@@ -9,12 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS);
@ISA = qw(Exporter IO::File);
-$VERSION = '2.060';
+$VERSION = '2.064';
use constant G_EOF => 0 ;
use constant G_ERR => -1 ;
-use IO::Compress::Base::Common 2.060 ;
+use IO::Compress::Base::Common 2.064 ;
use IO::File ;
use Symbol;
@@ -961,7 +961,7 @@ sub _raw_read
$self->pushBack($trailer) ;
}
- # TODO - if want to file file pointer, do it here
+ # TODO - if want file pointer, do it here
if (! $self->smartEof()) {
*$self->{NewStream} = 1 ;
@@ -1526,7 +1526,7 @@ IO::Uncompress::Base - Base Class for IO::Uncompress modules
=head1 DESCRIPTION
This module is not intended for direct use in application code. Its sole
-purpose if to to be sub-classed by IO::Uncompress modules.
+purpose is to be sub-classed by IO::Uncompress modules.
=head1 SEE ALSO
@@ -1548,7 +1548,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm
index ccfb69b2bd8..aad835f32f3 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Bunzip2.pm
@@ -4,15 +4,15 @@ use strict ;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.060 qw(:Status );
+use IO::Compress::Base::Common 2.064 qw(:Status );
-use IO::Uncompress::Base 2.060 ;
-use IO::Uncompress::Adapter::Bunzip2 2.060 ;
+use IO::Uncompress::Base 2.064 ;
+use IO::Uncompress::Adapter::Bunzip2 2.064 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error);
-$VERSION = '2.060';
+$VERSION = '2.064';
$Bunzip2Error = '';
@ISA = qw( Exporter IO::Uncompress::Base );
@@ -201,19 +201,20 @@ section.
use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
- bunzip2 $input => $output [,OPTS]
+ bunzip2 $input_filename_or_reference => $output_filename_or_reference [,OPTS]
or die "bunzip2 failed: $Bunzip2Error\n";
The functional interface needs Perl5.005 or better.
-=head2 bunzip2 $input => $output [, OPTS]
+=head2 bunzip2 $input_filename_or_reference => $output_filename_or_reference [, OPTS]
-C<bunzip2> expects at least two parameters, C<$input> and C<$output>.
+C<bunzip2> expects at least two parameters,
+C<$input_filename_or_reference> and C<$output_filename_or_reference>.
-=head3 The C<$input> parameter
+=head3 The C<$input_filename_or_reference> parameter
-The parameter, C<$input>, is used to define the source of
-the compressed data.
+The parameter, C<$input_filename_or_reference>, is used to define the
+source of the compressed data.
It can take one of the following forms:
@@ -221,25 +222,25 @@ It can take one of the following forms:
=item A filename
-If the C<$input> parameter is a simple scalar, it is assumed to be a
-filename. This file will be opened for reading and the input data
-will be read from it.
+If the <$input_filename_or_reference> parameter is a simple scalar, it is
+assumed to be a filename. This file will be opened for reading and the
+input data will be read from it.
=item A filehandle
-If the C<$input> parameter is a filehandle, the input data will be
-read from it.
-The string '-' can be used as an alias for standard input.
+If the C<$input_filename_or_reference> parameter is a filehandle, the input
+data will be read from it. The string '-' can be used as an alias for
+standard input.
=item A scalar reference
-If C<$input> is a scalar reference, the input data will be read
-from C<$$input>.
+If C<$input_filename_or_reference> is a scalar reference, the input data
+will be read from C<$$input_filename_or_reference>.
=item An array reference
-If C<$input> is an array reference, each element in the array must be a
-filename.
+If C<$input_filename_or_reference> is an array reference, each element in
+the array must be a filename.
The input data will be read from each file in turn.
@@ -248,64 +249,71 @@ contains valid filenames before any data is uncompressed.
=item An Input FileGlob string
-If C<$input> is a string that is delimited by the characters "<" and ">"
-C<bunzip2> will assume that it is an I<input fileglob string>. The
-input is the list of files that match the fileglob.
-
-If the fileglob does not match any files ...
+If C<$input_filename_or_reference> is a string that is delimited by the
+characters "<" and ">" C<bunzip2> will assume that it is an
+I<input fileglob string>. The input is the list of files that match the
+fileglob.
See L<File::GlobMapper|File::GlobMapper> for more details.
=back
-If the C<$input> parameter is any other type, C<undef> will be returned.
+If the C<$input_filename_or_reference> parameter is any other type,
+C<undef> will be returned.
-=head3 The C<$output> parameter
+=head3 The C<$output_filename_or_reference> parameter
-The parameter C<$output> is used to control the destination of the
-uncompressed data. This parameter can take one of these forms.
+The parameter C<$output_filename_or_reference> is used to control the
+destination of the uncompressed data. This parameter can take one of
+these forms.
=over 5
=item A filename
-If the C<$output> parameter is a simple scalar, it is assumed to be a
-filename. This file will be opened for writing and the uncompressed
-data will be written to it.
+If the C<$output_filename_or_reference> parameter is a simple scalar, it is
+assumed to be a filename. This file will be opened for writing and the
+uncompressed data will be written to it.
=item A filehandle
-If the C<$output> parameter is a filehandle, the uncompressed data
-will be written to it.
-The string '-' can be used as an alias for standard output.
+If the C<$output_filename_or_reference> parameter is a filehandle, the
+uncompressed data will be written to it. The string '-' can be used as
+an alias for standard output.
=item A scalar reference
-If C<$output> is a scalar reference, the uncompressed data will be
-stored in C<$$output>.
+If C<$output_filename_or_reference> is a scalar reference, the
+uncompressed data will be stored in C<$$output_filename_or_reference>.
=item An Array Reference
-If C<$output> is an array reference, the uncompressed data will be
-pushed onto the array.
+If C<$output_filename_or_reference> is an array reference,
+the uncompressed data will be pushed onto the array.
=item An Output FileGlob
-If C<$output> is a string that is delimited by the characters "<" and ">"
-C<bunzip2> will assume that it is an I<output fileglob string>. The
-output is the list of files that match the fileglob.
+If C<$output_filename_or_reference> is a string that is delimited by the
+characters "<" and ">" C<bunzip2> will assume that it is an
+I<output fileglob string>. The output is the list of files that match the
+fileglob.
-When C<$output> is an fileglob string, C<$input> must also be a fileglob
-string. Anything else is an error.
+When C<$output_filename_or_reference> is an fileglob string,
+C<$input_filename_or_reference> must also be a fileglob string. Anything
+else is an error.
+
+See L<File::GlobMapper|File::GlobMapper> for more details.
=back
-If the C<$output> parameter is any other type, C<undef> will be returned.
+If the C<$output_filename_or_reference> parameter is any other type,
+C<undef> will be returned.
=head2 Notes
-When C<$input> maps to multiple compressed files/buffers and C<$output> is
-a single file/buffer, after uncompression C<$output> will contain a
+When C<$input_filename_or_reference> maps to multiple compressed
+files/buffers and C<$output_filename_or_reference> is
+a single file/buffer, after uncompression C<$output_filename_or_reference> will contain a
concatenation of all the uncompressed data from each of the input
files/buffers.
@@ -337,7 +345,48 @@ Defaults to 0.
=item C<< Append => 0|1 >>
-TODO
+The behaviour of this option is dependent on the type of output data
+stream.
+
+=over 5
+
+=item * A Buffer
+
+If C<Append> is enabled, all uncompressed data will be append to the end of
+the output buffer. Otherwise the output buffer will be cleared before any
+uncompressed data is written to it.
+
+=item * A Filename
+
+If C<Append> is enabled, the file will be opened in append mode. Otherwise
+the contents of the file, if any, will be truncated before any uncompressed
+data is written to it.
+
+=item * A Filehandle
+
+If C<Append> is enabled, the filehandle will be positioned to the end of
+the file via a call to C<seek> before any uncompressed data is
+written to it. Otherwise the file pointer will not be moved.
+
+=back
+
+When C<Append> is specified, and set to true, it will I<append> all uncompressed
+data to the output data stream.
+
+So when the output is a filehandle it will carry out a seek to the eof
+before writing any uncompressed data. If the output is a filename, it will be opened for
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
+
+Conversely when C<Append> is not specified, or it is present and is set to
+false, it will operate as follows.
+
+When the output is a filename, it will truncate the contents of the file
+before writing any uncompressed data. If the output is a filehandle
+its position will not be changed. If the output is a buffer, it will be
+wiped before any uncompressed data is output.
+
+Defaults to 0.
=item C<< MultiStream => 0|1 >>
@@ -374,7 +423,7 @@ C<InputLength> option.
=head2 Examples
To read the contents of the file C<file1.txt.bz2> and write the
-compressed data to the file C<file1.txt>.
+uncompressed data to the file C<file1.txt>.
use strict ;
use warnings ;
@@ -462,7 +511,7 @@ The string '-' can be used as an alias for standard input.
=item A scalar reference
If C<$input> is a scalar reference, the compressed data will be read from
-C<$$output>.
+C<$$input>.
=back
@@ -517,7 +566,7 @@ the module will allow reading of it anyway.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
@@ -580,7 +629,7 @@ Usage is
$status = $z->read($buffer)
-Reads a block of compressed data (the size the the compressed block is
+Reads a block of compressed data (the size of the compressed block is
determined by the C<Buffer> option in the constructor), uncompresses it and
writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
set in the constructor, the uncompressed data will be appended to the
@@ -618,7 +667,7 @@ Usage is
Reads a single line.
-This method fully supports the use of of the variable C<$/> (or
+This method fully supports the use of the variable C<$/> (or
C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
determine what constitutes an end of line. Paragraph mode, record mode and
file slurp mode are all supported.
@@ -675,6 +724,13 @@ Provides a sub-set of the C<seek> functionality, with the restriction
that it is only legal to seek forward in the input file/buffer.
It is a fatal error to attempt to seek backward.
+Note that the implementation of C<seek> in this module does not provide
+true random access to a compressed file/buffer. It works by uncompressing
+data from the current offset in the file/buffer until it reaches the
+uncompressed offset specified in the parameters to C<seek>. For very small
+files this may be acceptable behaviour. For large files it may cause an
+unacceptable delay.
+
The C<$whence> parameter takes one the usual values, namely SEEK_SET,
SEEK_CUR or SEEK_END.
@@ -720,7 +776,7 @@ Returns the current uncompressed line number. If C<EXPR> is present it has
the effect of setting the line number. Note that setting the line number
does not change the current position within the file/buffer being read.
-The contents of C<$/> are used to to determine what constitutes a line
+The contents of C<$/> are used to determine what constitutes a line
terminator.
=head2 fileno
@@ -732,7 +788,7 @@ If the C<$z> object is associated with a file or a filehandle, C<fileno>
will return the underlying file descriptor. Once the C<close> method is
called C<fileno> will return C<undef>.
-If the C<$z> object is is associated with a buffer, this method will return
+If the C<$z> object is associated with a buffer, this method will return
C<undef>.
=head2 close
@@ -821,13 +877,13 @@ Same as doing this
=head2 Working with Net::FTP
-See L<IO::Uncompress::Bunzip2::FAQ|IO::Uncompress::Bunzip2::FAQ/"Compressed files and Net::FTP">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP">
=head1 SEE ALSO
-L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
+L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
-L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
+L<IO::Compress::FAQ|IO::Compress::FAQ>
L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
L<Archive::Tar|Archive::Tar>,
@@ -847,7 +903,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm
index 753d34a5bc9..b8012d0ee0d 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Gunzip.pm
@@ -9,12 +9,12 @@ use strict ;
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.060 ;
+use IO::Uncompress::RawInflate 2.064 ;
-use Compress::Raw::Zlib 2.060 () ;
-use IO::Compress::Base::Common 2.060 qw(:Status );
-use IO::Compress::Gzip::Constants 2.060 ;
-use IO::Compress::Zlib::Extra 2.060 ;
+use Compress::Raw::Zlib 2.064 () ;
+use IO::Compress::Base::Common 2.064 qw(:Status );
+use IO::Compress::Gzip::Constants 2.064 ;
+use IO::Compress::Zlib::Extra 2.064 ;
require Exporter ;
@@ -28,7 +28,7 @@ Exporter::export_ok_tags('all');
$GunzipError = '';
-$VERSION = '2.060';
+$VERSION = '2.064';
sub new
{
@@ -345,7 +345,7 @@ section.
The functional interface needs Perl5.005 or better.
-=head2 gunzip $input => $output [, OPTS]
+=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>.
@@ -811,7 +811,7 @@ Usage is
$status = $z->read($buffer)
-Reads a block of compressed data (the size the the compressed block is
+Reads a block of compressed data (the size of the compressed block is
determined by the C<Buffer> option in the constructor), uncompresses it and
writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
set in the constructor, the uncompressed data will be appended to the
@@ -849,7 +849,7 @@ Usage is
Reads a single line.
-This method fully supports the use of of the variable C<$/> (or
+This method fully supports the use of the variable C<$/> (or
C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
determine what constitutes an end of line. Paragraph mode, record mode and
file slurp mode are all supported.
@@ -933,7 +933,7 @@ It is a fatal error to attempt to seek backward.
Note that the implementation of C<seek> in this module does not provide
true random access to a compressed file/buffer. It works by uncompressing
data from the current offset in the file/buffer until it reaches the
-ucompressed offset specified in the parameters to C<seek>. For very small
+uncompressed offset specified in the parameters to C<seek>. For very small
files this may be acceptable behaviour. For large files it may cause an
unacceptable delay.
@@ -982,7 +982,7 @@ Returns the current uncompressed line number. If C<EXPR> is present it has
the effect of setting the line number. Note that setting the line number
does not change the current position within the file/buffer being read.
-The contents of C<$/> are used to to determine what constitutes a line
+The contents of C<$/> are used to determine what constitutes a line
terminator.
=head2 fileno
@@ -1118,7 +1118,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm
index 4cea9aa0028..a5df2eacb95 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Inflate.pm
@@ -5,15 +5,15 @@ use strict ;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.060 qw(:Status );
-use IO::Compress::Zlib::Constants 2.060 ;
+use IO::Compress::Base::Common 2.064 qw(:Status );
+use IO::Compress::Zlib::Constants 2.064 ;
-use IO::Uncompress::RawInflate 2.060 ;
+use IO::Uncompress::RawInflate 2.064 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
-$VERSION = '2.060';
+$VERSION = '2.064';
$InflateError = '';
@ISA = qw( Exporter IO::Uncompress::RawInflate );
@@ -267,7 +267,7 @@ section.
The functional interface needs Perl5.005 or better.
-=head2 inflate $input => $output [, OPTS]
+=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>.
@@ -699,7 +699,7 @@ Usage is
$status = $z->read($buffer)
-Reads a block of compressed data (the size the the compressed block is
+Reads a block of compressed data (the size of the compressed block is
determined by the C<Buffer> option in the constructor), uncompresses it and
writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
set in the constructor, the uncompressed data will be appended to the
@@ -737,7 +737,7 @@ Usage is
Reads a single line.
-This method fully supports the use of of the variable C<$/> (or
+This method fully supports the use of the variable C<$/> (or
C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
determine what constitutes an end of line. Paragraph mode, record mode and
file slurp mode are all supported.
@@ -805,7 +805,7 @@ It is a fatal error to attempt to seek backward.
Note that the implementation of C<seek> in this module does not provide
true random access to a compressed file/buffer. It works by uncompressing
data from the current offset in the file/buffer until it reaches the
-ucompressed offset specified in the parameters to C<seek>. For very small
+uncompressed offset specified in the parameters to C<seek>. For very small
files this may be acceptable behaviour. For large files it may cause an
unacceptable delay.
@@ -854,7 +854,7 @@ Returns the current uncompressed line number. If C<EXPR> is present it has
the effect of setting the line number. Note that setting the line number
does not change the current position within the file/buffer being read.
-The contents of C<$/> are used to to determine what constitutes a line
+The contents of C<$/> are used to determine what constitutes a line
terminator.
=head2 fileno
@@ -990,7 +990,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm
index 9a57eb343c6..b0259f30430 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/RawInflate.pm
@@ -5,16 +5,16 @@ use strict ;
use warnings;
#use bytes;
-use Compress::Raw::Zlib 2.060 ;
-use IO::Compress::Base::Common 2.060 qw(:Status );
+use Compress::Raw::Zlib 2.064 ;
+use IO::Compress::Base::Common 2.064 qw(:Status );
-use IO::Uncompress::Base 2.060 ;
-use IO::Uncompress::Adapter::Inflate 2.060 ;
+use IO::Uncompress::Base 2.064 ;
+use IO::Uncompress::Adapter::Inflate 2.064 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
-$VERSION = '2.060';
+$VERSION = '2.064';
$RawInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
@@ -415,7 +415,7 @@ section.
The functional interface needs Perl5.005 or better.
-=head2 rawinflate $input => $output [, OPTS]
+=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>.
@@ -827,7 +827,7 @@ Usage is
$status = $z->read($buffer)
-Reads a block of compressed data (the size the the compressed block is
+Reads a block of compressed data (the size of the compressed block is
determined by the C<Buffer> option in the constructor), uncompresses it and
writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
set in the constructor, the uncompressed data will be appended to the
@@ -865,7 +865,7 @@ Usage is
Reads a single line.
-This method fully supports the use of of the variable C<$/> (or
+This method fully supports the use of the variable C<$/> (or
C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
determine what constitutes an end of line. Paragraph mode, record mode and
file slurp mode are all supported.
@@ -933,7 +933,7 @@ It is a fatal error to attempt to seek backward.
Note that the implementation of C<seek> in this module does not provide
true random access to a compressed file/buffer. It works by uncompressing
data from the current offset in the file/buffer until it reaches the
-ucompressed offset specified in the parameters to C<seek>. For very small
+uncompressed offset specified in the parameters to C<seek>. For very small
files this may be acceptable behaviour. For large files it may cause an
unacceptable delay.
@@ -982,7 +982,7 @@ Returns the current uncompressed line number. If C<EXPR> is present it has
the effect of setting the line number. Note that setting the line number
does not change the current position within the file/buffer being read.
-The contents of C<$/> are used to to determine what constitutes a line
+The contents of C<$/> are used to determine what constitutes a line
terminator.
=head2 fileno
@@ -1118,7 +1118,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm b/Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm
index 4175136fc3c..3b36f839a05 100644
--- a/Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Uncompress/Unzip.pm
@@ -9,14 +9,14 @@ use warnings;
#use bytes;
use IO::File;
-use IO::Uncompress::RawInflate 2.060 ;
-use IO::Compress::Base::Common 2.060 qw(:Status );
-use IO::Uncompress::Adapter::Inflate 2.060 ;
-use IO::Uncompress::Adapter::Identity 2.060 ;
-use IO::Compress::Zlib::Extra 2.060 ;
-use IO::Compress::Zip::Constants 2.060 ;
+use IO::Uncompress::RawInflate 2.064 ;
+use IO::Compress::Base::Common 2.064 qw(:Status );
+use IO::Uncompress::Adapter::Inflate 2.064 ;
+use IO::Uncompress::Adapter::Identity 2.064 ;
+use IO::Compress::Zlib::Extra 2.064 ;
+use IO::Compress::Zip::Constants 2.064 ;
-use Compress::Raw::Zlib 2.060 () ;
+use Compress::Raw::Zlib 2.064 () ;
BEGIN
{
@@ -31,7 +31,7 @@ require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
-$VERSION = '2.060';
+$VERSION = '2.064';
$UnzipError = '';
@ISA = qw(Exporter IO::Uncompress::RawInflate);
@@ -1101,7 +1101,7 @@ section.
The functional interface needs Perl5.005 or better.
-=head2 unzip $input => $output [, OPTS]
+=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>.
@@ -1343,7 +1343,7 @@ specific member from the file, say C<"data1">, use the C<Name> option
or die "unzip failed: $UnzipError\n";
Alternatively, if you want to read the C<"data1"> member into memory, use
-a scalar reference for the C<output> partameter.
+a scalar reference for the C<output> parameter.
use strict ;
use warnings ;
@@ -1526,7 +1526,7 @@ Usage is
$status = $z->read($buffer)
-Reads a block of compressed data (the size the the compressed block is
+Reads a block of compressed data (the size of the compressed block is
determined by the C<Buffer> option in the constructor), uncompresses it and
writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
set in the constructor, the uncompressed data will be appended to the
@@ -1564,7 +1564,7 @@ Usage is
Reads a single line.
-This method fully supports the use of of the variable C<$/> (or
+This method fully supports the use of the variable C<$/> (or
C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
determine what constitutes an end of line. Paragraph mode, record mode and
file slurp mode are all supported.
@@ -1632,7 +1632,7 @@ It is a fatal error to attempt to seek backward.
Note that the implementation of C<seek> in this module does not provide
true random access to a compressed file/buffer. It works by uncompressing
data from the current offset in the file/buffer until it reaches the
-ucompressed offset specified in the parameters to C<seek>. For very small
+uncompressed offset specified in the parameters to C<seek>. For very small
files this may be acceptable behaviour. For large files it may cause an
unacceptable delay.
@@ -1681,7 +1681,7 @@ Returns the current uncompressed line number. If C<EXPR> is present it has
the effect of setting the line number. Note that setting the line number
does not change the current position within the file/buffer being read.
-The contents of C<$/> are used to to determine what constitutes a line
+The contents of C<$/> are used to determine what constitutes a line
terminator.
=head2 fileno
@@ -1821,6 +1821,13 @@ It is also worth noting that C<nextStream> can be called at any time -- you
don't have to wait until you have exhausted a compressed data stream before
skipping to the next one.
+=head2 Unzipping a complete zip file to disk
+
+Daniel S. Sterling has written a script that uses C<IO::Uncompress::UnZip>
+to read a zip file and unzip its contents to disk.
+
+The script is available from L<https://gist.github.com/eqhmcow/5389877>
+
=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::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
@@ -1854,7 +1861,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2013 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.