use warnings;
use bytes;
-use IO::Compress::Base::Common 2.008 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.009 qw(createSelfTiedObject);
-use IO::Uncompress::Base 2.008 ;
+use IO::Uncompress::Base 2.009 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError);
-$VERSION = '2.008';
+$VERSION = '2.009';
$AnyUncompressError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
BEGIN
{
- eval ' use IO::Uncompress::Adapter::Inflate 2.008 ;';
- eval ' use IO::Uncompress::Adapter::Bunzip2 2.008 ;';
- eval ' use IO::Uncompress::Adapter::LZO 2.008 ;';
- eval ' use IO::Uncompress::Adapter::Lzf 2.008 ;';
-
- eval ' use IO::Uncompress::Bunzip2 2.008 ;';
- eval ' use IO::Uncompress::UnLzop 2.008 ;';
- eval ' use IO::Uncompress::Gunzip 2.008 ;';
- eval ' use IO::Uncompress::Inflate 2.008 ;';
- eval ' use IO::Uncompress::RawInflate 2.008 ;';
- eval ' use IO::Uncompress::Unzip 2.008 ;';
- eval ' use IO::Uncompress::UnLzf 2.008 ;';
+ eval ' use IO::Uncompress::Adapter::Inflate 2.009 ;';
+ eval ' use IO::Uncompress::Adapter::Bunzip2 2.009 ;';
+ eval ' use IO::Uncompress::Adapter::LZO 2.009 ;';
+ eval ' use IO::Uncompress::Adapter::Lzf 2.009 ;';
+
+ eval ' use IO::Uncompress::Bunzip2 2.009 ;';
+ eval ' use IO::Uncompress::UnLzop 2.009 ;';
+ eval ' use IO::Uncompress::Gunzip 2.009 ;';
+ eval ' use IO::Uncompress::Inflate 2.009 ;';
+ eval ' use IO::Uncompress::RawInflate 2.009 ;';
+ eval ' use IO::Uncompress::Unzip 2.009 ;';
+ eval ' use IO::Uncompress::UnLzf 2.009 ;';
}
sub new
sub getExtraParams
{
- use IO::Compress::Base::Common 2.008 qw(:Parse);
+ use IO::Compress::Base::Common 2.009 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
=head1 NAME
-
IO::Uncompress::AnyUncompress - Uncompress gzip, zip, bzip2 or lzop file/buffer
-
=head1 SYNOPSIS
use IO::Uncompress::AnyUncompress qw(anyuncompress $AnyUncompressError) ;
eof($z)
close($z)
-
=head1 DESCRIPTION
-
This module provides a Perl interface that allows the reading of
files/buffers that have been compressed with a variety of compression
libraries.
The module will auto-detect which, if any, of the supported
compression formats is being used.
-
-
-
=head1 Functional Interface
A top-level function, C<anyuncompress>, is provided to carry out
anyuncompress $input => $output [,OPTS]
or die "anyuncompress failed: $AnyUncompressError\n";
-
-
The functional interface needs Perl5.005 or better.
-
=head2 anyuncompress $input => $output [, OPTS]
-
C<anyuncompress> expects at least two parameters, C<$input> and C<$output>.
=head3 The C<$input> parameter
The complete array will be walked to ensure that it only
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 ">"
See L<File::GlobMapper|File::GlobMapper> for more details.
-
=back
If the C<$input> parameter is any other type, C<undef> will be returned.
-
-
=head3 The C<$output> parameter
The parameter C<$output> is used to control the destination of the
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>.
-
-
=item An Array Reference
If C<$output> is an array reference, the uncompressed data will be
If the C<$output> 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
concatenation of all the uncompressed data from each of the input
files/buffers.
-
-
-
-
=head2 Optional Parameters
Unless specified below, the optional parameters for C<anyuncompress>,
This parameter defaults to 0.
-
=item C<< BinModeOut => 0|1 >>
When writing to a file or filehandle, set C<binmode> before writing to the
Defaults to 0.
-
-
-
-
=item C<< Append => 0|1 >>
TODO
=item C<< MultiStream => 0|1 >>
-
If the input file/buffer contains multiple compressed data streams, this
option will uncompress the whole lot as a single data stream.
Defaults to 0.
-
-
-
-
=item C<< TrailingData => $scalar >>
Returns the data, if any, that is present immediately after the compressed
Don't bother using C<trailingData> if the input is a filename.
-
-
If you know the length of the compressed data stream before you start
uncompressing, you can avoid having to use C<trailingData> by setting the
C<InputLength> option.
-
-
=back
-
-
-
=head2 Examples
To read the contents of the file C<file1.txt.Compressed> and write the
anyuncompress $input => $output
or die "anyuncompress failed: $AnyUncompressError\n";
-
To read from an existing Perl filehandle, C<$input>, and write the
uncompressed data to a buffer, C<$buffer>.
The format of the constructor for IO::Uncompress::AnyUncompress is shown below
-
my $z = new IO::Uncompress::AnyUncompress $input [OPTS]
or die "IO::Uncompress::AnyUncompress failed: $AnyUncompressError\n";
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 compressed data will be read from
=head2 Constructor Options
-
The option names defined below are case insensitive and can be optionally
prefixed by a '-'. So all of the following are valid
=item C<< MultiStream => 0|1 >>
-
-
Allows multiple concatenated compressed streams to be treated as a single
compressed stream. Decompression will stop once either the end of the
file/buffer is reached, an error is encountered (premature eof, corrupt
This parameter defaults to 0.
-
=item C<< Prime => $string >>
This option will uncompress the contents of C<$string> before processing the
the file pointer will be left pointing to the first byte directly after the
compressed data stream.
-
-
This option defaults to off.
=item C<< Append => 0|1 >>
=item C<< Strict => 0|1 >>
-
-
This option controls whether the extra checks defined below are used when
carrying out the decompression. When Strict is on, the extra tests are
carried out, when Strict is off they are not.
The default for this option is off.
-
-
-
-
-
-
-
-
-
-
=item C<< RawInflate => 0|1 >>
When auto-detecting the compressed format, try to test for raw-deflate (RFC
Defaults to 0.
-
-
-
-
-
=back
=head2 Examples
Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
or a negative number on error.
-
=head2 getline
Usage is
determine what constitutes an end of line. Paragraph mode, record mode and
file slurp mode are all supported.
-
=head2 getc
Usage is
$char = $z->ungetc($string)
-
-
-
=head2 getHeaderInfo
Usage is
or hash references (in array context) that contains information about each
of the header fields in the compressed data stream(s).
-
-
-
=head2 tell
Usage is
$z->eof();
eof($z);
-
-
Returns true if the end of the compressed input stream has been reached.
-
-
=head2 seek
$z->seek($position, $whence);
seek($z, $position, $whence);
-
-
-
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.
-
-
The C<$whence> parameter takes one the usual values, namely SEEK_SET,
SEEK_CUR or SEEK_END.
$z->input_line_number()
$z->input_line_number(EXPR)
-
-
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
terminator.
-
-
=head2 fileno
$z->fileno()
fileno($z)
-If the C<$z> object is associated with a file or a filehandle, this method
-will return the underlying file descriptor.
+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 undef.
+If the C<$z> object is is associated with a buffer, this method will return
+C<undef>.
=head2 close
$z->close() ;
close $z ;
-
-
Closes the output file/buffer.
-
-
For most versions of Perl this method will be automatically invoked if
the IO::Uncompress::AnyUncompress object is destroyed (either explicitly or by the
variable with the reference to the object going out of scope). The
object was created, and the object is associated with a file, the
underlying file will also be closed.
-
-
-
=head2 nextStream
Usage is
Don't bother using C<trailingData> if the input is a filename.
-
-
If you know the length of the compressed data stream before you start
uncompressing, you can avoid having to use C<trailingData> by setting the
C<InputLength> option in the constructor.
=head1 EXAMPLES
-
-
-
=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::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>
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-2007 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2008 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.