GIF89a;
EcchiShell v1.0
/
/
proc/
self/
root/
usr/
share/
perl5/
_create(undef, 0, @_);
}
sub anyuncompress
{
my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$AnyUncompressError);
return $obj->_inf(@_) ;
}
sub getExtraParams
{
return ( 'rawinflate' => [IO::Compress::Base::Common::Parse_boolean, 0] ,
'unlzma' => [IO::Compress::Base::Common::Parse_boolean, 0] ) ;
}
sub ckParams
{
my $self = shift ;
my $got = shift ;
# any always needs both crc32 and adler32
$got->setValue('crc32' => 1);
$got->setValue('adler32' => 1);
return 1;
}
sub mkUncomp
{
my $self = shift ;
my $got = shift ;
my $magic ;
# try zlib first
if (defined $IO::Uncompress::RawInflate::VERSION )
{
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject();
return $self->saveErrorString(undef, $errstr, $errno)
if ! defined $obj;
*$self->{Uncomp} = $obj;
my @possible = qw( Inflate Gunzip Unzip );
unshift @possible, 'RawInflate'
if $got->getValue('rawinflate');
$magic = $self->ckMagic( @possible );
if ($magic) {
*$self->{Info} = $self->readHeader($magic)
or return undef ;
return 1;
}
}
if (defined $IO::Uncompress::UnLzma::VERSION && $got->getValue('unlzma'))
{
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnLzma::mkUncompObject();
return $self->saveErrorString(undef, $errstr, $errno)
if ! defined $obj;
*$self->{Uncomp} = $obj;
my @possible = qw( UnLzma );
#unshift @possible, 'RawInflate'
# if $got->getValue('rawinflate');
if ( *$self->{Info} = $self->ckMagic( @possible ))
{
return 1;
}
}
if (defined $IO::Uncompress::UnXz::VERSION and
$magic = $self->ckMagic('UnXz')) {
*$self->{Info} = $self->readHeader($magic)
or return undef ;
my ($obj, $errstr, $errno) =
IO::Uncompress::Adapter::UnXz::mkUncompObject();
return $self->saveErrorString(undef, $errstr, $errno)
if ! defined $obj;
*$self->{Uncomp} = $obj;
return 1;
}
if (defined $IO::Uncompress::Bunzip2::VERSION and
$magic = $self->ckMagic('Bunzip2')) {
*$self->{Info} = $self->readHeader($magic)
or return undef ;
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Bunzip2::mkUncompObject();
return $self->saveErrorString(undef, $errstr, $errno)
if ! defined $obj;
*$self->{Uncomp} = $obj;
return 1;
}
if (defined $IO::Uncompress::UnLzop::VERSION and
$magic = $self->ckMagic('UnLzop')) {
*$self->{Info} = $self->readHeader($magic)
or return undef ;
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::LZO::mkUncompObject();
return $self->saveErrorString(undef, $errstr, $errno)
if ! defined $obj;
*$self->{Uncomp} = $obj;
return 1;
}
if (defined $IO::Uncompress::UnLzf::VERSION and
$magic = $self->ckMagic('UnLzf')) {
*$self->{Info} = $self->readHeader($magic)
or return undef ;
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Lzf::mkUncompObject();
return $self->saveErrorString(undef, $errstr, $errno)
if ! defined $obj;
*$self->{Uncomp} = $obj;
return 1;
}
return 0 ;
}
sub ckMagic
{
my $self = shift;
my @names = @_ ;
my $keep = ref $self ;
for my $class ( map { "IO::Uncompress::$_" } @names)
{
bless $self => $class;
my $magic = $self->ckMagic();
if ($magic)
{
#bless $self => $class;
return $magic ;
}
$self->pushBack(*$self->{HeaderPending}) ;
*$self->{HeaderPending} = '' ;
}
bless $self => $keep;
return undef;
}
1 ;
__END__
=head1 NAME
IO::Uncompress::AnyUncompress - Uncompress gzip, zip, bzip2 or lzop file/buffer
=head1 SYNOPSIS
use IO::Uncompress::AnyUncompress qw(anyuncompress $AnyUncompressError) ;
my $status = anyuncompress $input => $output [,OPTS]
or die "anyuncompress failed: $AnyUncompressError\n";
my $z = new IO::Uncompress::AnyUncompress $input [OPTS]
or die "anyuncompress failed: $AnyUncompressError\n";
$status = $z->read($buffer)
$status = $z->read($buffer, $length)
$status = $z->read($buffer, $length, $offset)
$line = $z->getline()
$char = $z->getc()
$char = $z->ungetc()
$char = $z->opened()
$data = $z->trailingData()
$status = $z->nextStream()
$data = $z->getHeaderInfo()
$z->tell()
$z->seek($position, $whence)
$z->binmode()
$z->fileno()
$z->eof()
$z->close()
$AnyUncompressError ;
# IO::File mode
<$z>
read($z, $buffer);
read($z, $buffer, $length);
read($z, $buffer, $length, $offset);
tell($z)
seek($z, $position, $whence)
binmode($z)
fileno($z)
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 formats supported are:
=over 5
=item RFC 1950
=item RFC 1951 (optionally)
=item gzip (RFC 1952)
=item zip
=item bzip2
=item lzop
=item lzf
=item lzma
=item xz
=back
The module will auto-detect which, if any, of the supported
compression formats is being used.
=head1 Functional Interface
A top-level function, C, is provided to carry out
"one-shot" uncompression between buffers and/or files. For finer
control over the uncompression process, see the L"OO Interface">
section.
use IO::Uncompress::AnyUncompress qw(anyuncompress $AnyUncompressError) ;
anyuncompress $input_filename_or_reference => $output_filename_or_reference [,OPTS]
or die "anyuncompress failed: $AnyUncompressError\n";
The functional interface needs Perl5.005 or better.
=head2 anyuncompress $input_filename_or_reference => $output_filename_or_reference [, OPTS]
C expects at least two parameters,
C<$input_filename_or_reference> and C<$output_filename_or_reference>.
=head3 The C<$input_filename_or_reference> parameter
The parameter, C<$input_filename_or_reference>, is used to define the
source of the compressed data.
It can take one of the following forms:
=over 5
=item A filename
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_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_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_filename_or_reference> is an array reference, each element in
the array must be a filename.
The input data will be read from each file in turn.
The 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_filename_or_reference> is a string that is delimited by the
characters "<" and ">" C will assume that it is an
I. The input is the list of files that match the
fileglob.
See L for more details.
=back
If the C<$input_filename_or_reference> parameter is any other type,
C will be returned.
=head3 The C<$output_filename_or_reference> parameter
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_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_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_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_filename_or_reference> is an array reference,
the uncompressed data will be pushed onto the array.
=item An Output FileGlob
If C<$output_filename_or_reference> is a string that is delimited by the
characters "<" and ">" C will assume that it is an
I