summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/cpan/IO-Compress/lib/IO/Uncompress/Base.pm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/cpan/IO-Compress/lib/IO/Uncompress/Base.pm')
-rw-r--r--gnu/usr.bin/perl/cpan/IO-Compress/lib/IO/Uncompress/Base.pm333
1 files changed, 126 insertions, 207 deletions
diff --git a/gnu/usr.bin/perl/cpan/IO-Compress/lib/IO/Uncompress/Base.pm b/gnu/usr.bin/perl/cpan/IO-Compress/lib/IO/Uncompress/Base.pm
index 4d1b7802850..33f2ac23758 100644
--- a/gnu/usr.bin/perl/cpan/IO-Compress/lib/IO/Uncompress/Base.pm
+++ b/gnu/usr.bin/perl/cpan/IO-Compress/lib/IO/Uncompress/Base.pm
@@ -3,27 +3,31 @@ package IO::Uncompress::Base ;
use strict ;
use warnings;
-#use bytes;
+use bytes;
our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS);
@ISA = qw(Exporter IO::File);
-$VERSION = '2.064';
+$VERSION = '2.024';
use constant G_EOF => 0 ;
use constant G_ERR => -1 ;
-use IO::Compress::Base::Common 2.064 ;
+use IO::Compress::Base::Common 2.024 ;
+#use Parse::Parameters ;
use IO::File ;
use Symbol;
-use Scalar::Util ();
-use List::Util ();
+use Scalar::Util qw(readonly);
+use List::Util qw(min);
use Carp ;
%EXPORT_TAGS = ( );
push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
+#Exporter::export_ok_tags('all') ;
+
+
sub smartRead
{
@@ -33,16 +37,16 @@ sub smartRead
$$out = "" ;
my $offset = 0 ;
- my $status = 1;
if (defined *$self->{InputLength}) {
return 0
if *$self->{InputLengthRemaining} <= 0 ;
- $size = List::Util::min($size, *$self->{InputLengthRemaining});
+ $size = min($size, *$self->{InputLengthRemaining});
}
if ( length *$self->{Prime} ) {
+ #$$out = substr(*$self->{Prime}, 0, $size, '') ;
$$out = substr(*$self->{Prime}, 0, $size) ;
substr(*$self->{Prime}, 0, $size) = '' ;
if (length $$out == $size) {
@@ -65,12 +69,11 @@ sub smartRead
# because the filehandle may not support the offset parameter
# An example is Net::FTP
my $tmp = '';
- $status = *$self->{FH}->read($tmp, $get_size) ;
- substr($$out, $offset) = $tmp
- if defined $status && $status > 0 ;
+ *$self->{FH}->read($tmp, $get_size) &&
+ (substr($$out, $offset) = $tmp);
}
else
- { $status = *$self->{FH}->read($$out, $get_size) }
+ { *$self->{FH}->read($$out, $get_size) }
}
elsif (defined *$self->{InputEvent}) {
my $got = 1 ;
@@ -80,6 +83,7 @@ sub smartRead
}
if (length $$out > $size ) {
+ #*$self->{Prime} = substr($$out, $size, length($$out), '');
*$self->{Prime} = substr($$out, $size, length($$out));
substr($$out, $size, length($$out)) = '';
}
@@ -90,6 +94,7 @@ sub smartRead
no warnings 'uninitialized';
my $buf = *$self->{Buffer} ;
$$buf = '' unless defined $$buf ;
+ #$$out = '' unless defined $$out ;
substr($$out, $offset) = substr($$buf, *$self->{BufferOffset}, $get_size);
if (*$self->{ConsumeInput})
{ substr($$buf, 0, $get_size) = '' }
@@ -100,11 +105,6 @@ sub smartRead
*$self->{InputLengthRemaining} -= length($$out) #- $offset
if defined *$self->{InputLength};
- if (! defined $status) {
- $self->saveStatus($!) ;
- return STATUS_ERROR;
- }
-
$self->saveStatus(length $$out < 0 ? STATUS_ERROR : STATUS_OK) ;
return length $$out;
@@ -140,38 +140,19 @@ sub smartSeek
my $self = shift ;
my $offset = shift ;
my $truncate = shift;
- my $position = shift || SEEK_SET;
+ #print "smartSeek to $offset\n";
# TODO -- need to take prime into account
if (defined *$self->{FH})
- { *$self->{FH}->seek($offset, $position) }
+ { *$self->{FH}->seek($offset, SEEK_SET) }
else {
- if ($position == SEEK_END) {
- *$self->{BufferOffset} = length ${ *$self->{Buffer} } + $offset ;
- }
- elsif ($position == SEEK_CUR) {
- *$self->{BufferOffset} += $offset ;
- }
- else {
- *$self->{BufferOffset} = $offset ;
- }
-
+ *$self->{BufferOffset} = $offset ;
substr(${ *$self->{Buffer} }, *$self->{BufferOffset}) = ''
if $truncate;
return 1;
}
}
-sub smartTell
-{
- my $self = shift ;
-
- if (defined *$self->{FH})
- { return *$self->{FH}->tell() }
- else
- { return *$self->{BufferOffset} }
-}
-
sub smartWrite
{
my $self = shift ;
@@ -210,8 +191,7 @@ sub smartEof
#
# here, but this can cause trouble if
# the filehandle is itself a tied handle, but it uses sysread.
- # Then we get into mixing buffered & non-buffered IO,
- # which will cause trouble
+ # Then we get into mixing buffered & non-buffered IO, which will cause trouble
my $info = $self->getErrInfo();
@@ -219,7 +199,7 @@ sub smartEof
my $status = $self->smartRead(\$buffer, 1);
$self->pushBack($buffer) if length $buffer;
$self->setErrInfo($info);
-
+
return $status == 0 ;
}
elsif (defined *$self->{InputEvent})
@@ -256,6 +236,8 @@ sub saveStatus
{
my $self = shift ;
my $errno = shift() + 0 ;
+ #return $errno unless $errno || ! defined *$self->{ErrorNo};
+ #return $errno unless $errno ;
*$self->{ErrorNo} = $errno;
${ *$self->{Error} } = '' ;
@@ -269,9 +251,12 @@ sub saveErrorString
my $self = shift ;
my $retval = shift ;
+ #return $retval if ${ *$self->{Error} };
+
${ *$self->{Error} } = shift ;
- *$self->{ErrorNo} = @_ ? shift() + 0 : STATUS_ERROR ;
+ *$self->{ErrorNo} = shift() + 0 if @_ ;
+ #warn "saveErrorString: " . ${ *$self->{Error} } . " " . *$self->{Error} . "\n" ;
return $retval;
}
@@ -348,34 +333,34 @@ sub checkParams
my $got = shift || IO::Compress::Base::Parameters::new();
my $Valid = {
- 'blocksize' => [IO::Compress::Base::Common::Parse_unsigned, 16 * 1024],
- 'autoclose' => [IO::Compress::Base::Common::Parse_boolean, 0],
- 'strict' => [IO::Compress::Base::Common::Parse_boolean, 0],
- 'append' => [IO::Compress::Base::Common::Parse_boolean, 0],
- 'prime' => [IO::Compress::Base::Common::Parse_any, undef],
- 'multistream' => [IO::Compress::Base::Common::Parse_boolean, 0],
- 'transparent' => [IO::Compress::Base::Common::Parse_any, 1],
- 'scan' => [IO::Compress::Base::Common::Parse_boolean, 0],
- 'inputlength' => [IO::Compress::Base::Common::Parse_unsigned, undef],
- 'binmodeout' => [IO::Compress::Base::Common::Parse_boolean, 0],
- #'decode' => [IO::Compress::Base::Common::Parse_any, undef],
-
- #'consumeinput' => [IO::Compress::Base::Common::Parse_boolean, 0],
-
+ 'BlockSize' => [1, 1, Parse_unsigned, 16 * 1024],
+ 'AutoClose' => [1, 1, Parse_boolean, 0],
+ 'Strict' => [1, 1, Parse_boolean, 0],
+ 'Append' => [1, 1, Parse_boolean, 0],
+ 'Prime' => [1, 1, Parse_any, undef],
+ 'MultiStream' => [1, 1, Parse_boolean, 0],
+ 'Transparent' => [1, 1, Parse_any, 1],
+ 'Scan' => [1, 1, Parse_boolean, 0],
+ 'InputLength' => [1, 1, Parse_unsigned, undef],
+ 'BinModeOut' => [1, 1, Parse_boolean, 0],
+ #'Encode' => [1, 1, Parse_any, undef],
+
+ #'ConsumeInput' => [1, 1, Parse_boolean, 0],
+
$self->getExtraParams(),
#'Todo - Revert to ordinary file on end Z_STREAM_END'=> 0,
# ContinueAfterEof
} ;
- $Valid->{trailingdata} = [IO::Compress::Base::Common::Parse_writable_scalar, undef]
+ $Valid->{TrailingData} = [1, 1, Parse_writable_scalar, undef]
if *$self->{OneShot} ;
$got->parse($Valid, @_ )
- or $self->croakError("${class}: " . $got->getError()) ;
+ or $self->croakError("${class}: $got->{Error}") ;
$self->postCheckParams($got)
- or $self->croakError("${class}: " . $self->error()) ;
+ or $self->croakError("${class}: " . $self->error()) ;
return $got;
}
@@ -392,7 +377,7 @@ sub _create
my $inValue = shift ;
- *$obj->{OneShot} = 0 ;
+ *$obj->{OneShot} = 0 ;
if (! $got)
{
@@ -422,12 +407,12 @@ sub _create
# Need to rewind for Scan
*$obj->{FH}->seek(0, SEEK_SET)
- if $got->getValue('scan');
+ if $got->value('Scan');
}
else {
no warnings ;
my $mode = '<';
- $mode = '+<' if $got->getValue('scan');
+ $mode = '+<' if $got->value('Scan');
*$obj->{StdIO} = ($inValue eq '-');
*$obj->{FH} = new IO::File "$mode $inValue"
or return $obj->saveErrorString(undef, "cannot open file '$inValue': $!", $!) ;
@@ -440,34 +425,32 @@ sub _create
*$obj->{Buffer} = \$buff ;
}
-# if ($got->getValue('decode')) {
-# my $want_encoding = $got->getValue('decode');
-# *$obj->{Encoding} = IO::Compress::Base::Common::getEncoding($obj, $class, $want_encoding);
-# }
-# else {
-# *$obj->{Encoding} = undef;
-# }
+ if ($got->parsed('Encode')) {
+ my $want_encoding = $got->value('Encode');
+ *$obj->{Encoding} = getEncoding($obj, $class, $want_encoding);
+ }
+
- *$obj->{InputLength} = $got->parsed('inputlength')
- ? $got->getValue('inputlength')
+ *$obj->{InputLength} = $got->parsed('InputLength')
+ ? $got->value('InputLength')
: undef ;
- *$obj->{InputLengthRemaining} = $got->getValue('inputlength');
+ *$obj->{InputLengthRemaining} = $got->value('InputLength');
*$obj->{BufferOffset} = 0 ;
- *$obj->{AutoClose} = $got->getValue('autoclose');
- *$obj->{Strict} = $got->getValue('strict');
- *$obj->{BlockSize} = $got->getValue('blocksize');
- *$obj->{Append} = $got->getValue('append');
- *$obj->{AppendOutput} = $append_mode || $got->getValue('append');
- *$obj->{ConsumeInput} = $got->getValue('consumeinput');
- *$obj->{Transparent} = $got->getValue('transparent');
- *$obj->{MultiStream} = $got->getValue('multistream');
+ *$obj->{AutoClose} = $got->value('AutoClose');
+ *$obj->{Strict} = $got->value('Strict');
+ *$obj->{BlockSize} = $got->value('BlockSize');
+ *$obj->{Append} = $got->value('Append');
+ *$obj->{AppendOutput} = $append_mode || $got->value('Append');
+ *$obj->{ConsumeInput} = $got->value('ConsumeInput');
+ *$obj->{Transparent} = $got->value('Transparent');
+ *$obj->{MultiStream} = $got->value('MultiStream');
# TODO - move these two into RawDeflate
- *$obj->{Scan} = $got->getValue('scan');
- *$obj->{ParseExtra} = $got->getValue('parseextra')
- || $got->getValue('strict') ;
+ *$obj->{Scan} = $got->value('Scan');
+ *$obj->{ParseExtra} = $got->value('ParseExtra')
+ || $got->value('Strict') ;
*$obj->{Type} = '';
- *$obj->{Prime} = $got->getValue('prime') || '' ;
+ *$obj->{Prime} = $got->value('Prime') || '' ;
*$obj->{Pending} = '';
*$obj->{Plain} = 0;
*$obj->{PlainBytesRead} = 0;
@@ -491,32 +474,14 @@ sub _create
return undef
unless defined $status;
- *$obj->{InNew} = 0;
- *$obj->{Closed} = 0;
-
- if ($status) {
- # Need to try uncompressing to catch the case
- # where the compressed file uncompresses to an
- # empty string - so eof is set immediately.
-
- my $out_buffer = '';
-
- $status = $obj->read(\$out_buffer);
-
- if ($status < 0) {
- *$obj->{ReadStatus} = [ $status, $obj->error(), $obj->errorNo() ];
- }
-
- $obj->ungetc($out_buffer)
- if length $out_buffer;
- }
- else {
+ if ( ! $status) {
return undef
unless *$obj->{Transparent};
$obj->clearError();
*$obj->{Type} = 'plain';
*$obj->{Plain} = 1;
+ #$status = $obj->mkIdentityUncomp($class, $got);
$obj->pushBack(*$obj->{HeaderPending}) ;
}
@@ -579,36 +544,13 @@ sub _inf
my $got = $obj->checkParams($name, undef, @_)
or return undef ;
- if ($got->parsed('trailingdata'))
+ if ($got->parsed('TrailingData'))
{
-# my $value = $got->valueRef('TrailingData');
-# warn "TD $value ";
-# #$value = $$value;
-## warn "TD $value $$value ";
-#
-# return retErr($obj, "Parameter 'TrailingData' not writable")
-# if readonly $$value ;
-#
-# if (ref $$value)
-# {
-# return retErr($obj,"Parameter 'TrailingData' not a scalar reference")
-# if ref $$value ne 'SCALAR' ;
-#
-# *$obj->{TrailingData} = $$value ;
-# }
-# else
-# {
-# return retErr($obj,"Parameter 'TrailingData' not a scalar")
-# if ref $value ne 'SCALAR' ;
-#
-# *$obj->{TrailingData} = $value ;
-# }
-
- *$obj->{TrailingData} = $got->getValue('trailingdata');
+ *$obj->{TrailingData} = $got->value('TrailingData');
}
- *$obj->{MultiStream} = $got->getValue('multistream');
- $got->setValue('multistream', 0);
+ *$obj->{MultiStream} = $got->value('MultiStream');
+ $got->value('MultiStream', 0);
$x->{Got} = $got ;
@@ -688,17 +630,17 @@ sub _singleTarget
if ($x->{outType} eq 'filename') {
my $mode = '>' ;
$mode = '>>'
- if $x->{Got}->getValue('append') ;
+ if $x->{Got}->value('Append') ;
$x->{fh} = new IO::File "$mode $output"
or return retErr($x, "cannot open file '$output': $!") ;
- binmode $x->{fh} if $x->{Got}->valueOrDefault('binmodeout');
+ binmode $x->{fh} if $x->{Got}->valueOrDefault('BinModeOut');
}
elsif ($x->{outType} eq 'handle') {
$x->{fh} = $output;
- binmode $x->{fh} if $x->{Got}->valueOrDefault('binmodeout');
- if ($x->{Got}->getValue('append')) {
+ binmode $x->{fh} if $x->{Got}->valueOrDefault('BinModeOut');
+ if ($x->{Got}->value('Append')) {
seek($x->{fh}, 0, SEEK_END)
or return retErr($x, "Cannot seek to end of output filehandle: $!") ;
}
@@ -708,7 +650,7 @@ sub _singleTarget
elsif ($x->{outType} eq 'buffer' )
{
$$output = ''
- unless $x->{Got}->getValue('append');
+ unless $x->{Got}->value('Append');
$x->{buff} = $output ;
}
@@ -728,7 +670,7 @@ sub _singleTarget
if ( ($x->{outType} eq 'filename' && $output ne '-') ||
- ($x->{outType} eq 'handle' && $x->{Got}->getValue('autoclose'))) {
+ ($x->{outType} eq 'handle' && $x->{Got}->value('AutoClose'))) {
$x->{fh}->close()
or return retErr($x, $!);
delete $x->{fh};
@@ -744,7 +686,7 @@ sub _rd2
my $input = shift;
my $output = shift;
- my $z = IO::Compress::Base::Common::createSelfTiedObject($x->{Class}, *$self->{Error});
+ my $z = createSelfTiedObject($x->{Class}, *$self->{Error});
$z->_create($x->{Got}, 1, $input, @_)
or return undef ;
@@ -756,7 +698,7 @@ sub _rd2
while (($status = $z->read($x->{buff})) > 0) {
if ($fh) {
- syswrite $fh, ${ $x->{buff} }
+ print $fh ${ $x->{buff} }
or return $z->saveErrorString(undef, "Error writing to output file: $!", $!);
${ $x->{buff} } = '' ;
}
@@ -775,6 +717,7 @@ sub _rd2
}
last if $status < 0 || $z->smartEof();
+ #last if $status < 0 ;
last
unless *$self->{MultiStream};
@@ -828,13 +771,13 @@ sub readBlock
*$self->{CompressedInputLengthDone} = 1;
return STATUS_OK ;
}
- $size = List::Util::min($size, *$self->{CompressedInputLengthRemaining} );
+ $size = min($size, *$self->{CompressedInputLengthRemaining} );
*$self->{CompressedInputLengthRemaining} -= $size ;
}
my $status = $self->smartRead($buff, $size) ;
- return $self->saveErrorString(STATUS_ERROR, "Error Reading Data: $!", $!)
- if $status == STATUS_ERROR ;
+ return $self->saveErrorString(STATUS_ERROR, "Error Reading Data")
+ if $status < 0 ;
if ($status == 0 ) {
*$self->{Closed} = 1 ;
@@ -860,6 +803,7 @@ sub _raw_read
my $self = shift ;
return G_EOF if *$self->{Closed} ;
+ #return G_EOF if !length *$self->{Pending} && *$self->{EndStream} ;
return G_EOF if *$self->{EndStream} ;
my $buffer = shift ;
@@ -870,7 +814,7 @@ sub _raw_read
my $len = $self->smartRead(\$tmp_buff, *$self->{BlockSize}) ;
return $self->saveErrorString(G_ERR, "Error reading data: $!", $!)
- if $len == STATUS_ERROR ;
+ if $len < 0 ;
if ($len == 0 ) {
*$self->{EndStream} = 1 ;
@@ -899,7 +843,6 @@ sub _raw_read
my $temp_buf = '';
my $outSize = 0;
my $status = $self->readBlock(\$temp_buf, *$self->{BlockSize}, $outSize) ;
-
return G_ERR
if $status == STATUS_ERROR ;
@@ -928,19 +871,18 @@ sub _raw_read
*$self->{TotalInflatedBytesRead} += $buf_len ;
*$self->{UnCompSize}->add($buf_len) ;
- $self->filterUncompressed($buffer, $before_len);
+ $self->filterUncompressed($buffer);
-# if (*$self->{Encoding}) {
-# use Encode ;
-# *$self->{PendingDecode} .= substr($$buffer, $before_len) ;
-# my $got = *$self->{Encoding}->decode(*$self->{PendingDecode}, Encode::FB_QUIET) ;
-# substr($$buffer, $before_len) = $got;
-# }
+ if (*$self->{Encoding}) {
+ $$buffer = *$self->{Encoding}->decode($$buffer);
+ }
}
if ($status == STATUS_ENDSTREAM) {
*$self->{EndStream} = 1 ;
+#$self->pushBack($temp_buf) ;
+#$temp_buf = '';
my $trailer;
my $trailer_size = *$self->{Info}{TrailerLength} ;
@@ -961,7 +903,7 @@ sub _raw_read
$self->pushBack($trailer) ;
}
- # TODO - if want file pointer, do it here
+ # TODO - if want to file file pointer, do it here
if (! $self->smartEof()) {
*$self->{NewStream} = 1 ;
@@ -1030,16 +972,15 @@ sub gotoNextStream
*$self->{NewStream} = 0 ;
*$self->{EndStream} = 0 ;
- *$self->{CompressedInputLengthDone} = undef ;
- *$self->{CompressedInputLength} = undef ;
$self->reset();
*$self->{UnCompSize}->reset();
*$self->{CompSize}->reset();
my $magic = $self->ckMagic();
+ #*$self->{EndStream} = 0 ;
if ( ! defined $magic) {
- if (! *$self->{Transparent} || $self->eof())
+ if (! *$self->{Transparent} )
{
*$self->{EndStream} = 1 ;
return 0;
@@ -1072,13 +1013,6 @@ sub streamCount
return scalar @{ *$self->{InfoList} } ;
}
-#sub read
-#{
-# my $status = myRead(@_);
-# return undef if $status < 0;
-# return $status;
-#}
-
sub read
{
# return codes
@@ -1088,20 +1022,13 @@ sub read
my $self = shift ;
- if (defined *$self->{ReadStatus} ) {
- my $status = *$self->{ReadStatus}[0];
- $self->saveErrorString( @{ *$self->{ReadStatus} } );
- delete *$self->{ReadStatus} ;
- return $status ;
- }
-
return G_EOF if *$self->{Closed} ;
my $buffer ;
if (ref $_[0] ) {
$self->croakError(*$self->{ClassName} . "::read: buffer parameter is read-only")
- if Scalar::Util::readonly(${ $_[0] });
+ if readonly(${ $_[0] });
$self->croakError(*$self->{ClassName} . "::read: not a scalar reference $_[0]" )
unless ref $_[0] eq 'SCALAR' ;
@@ -1109,7 +1036,7 @@ sub read
}
else {
$self->croakError(*$self->{ClassName} . "::read: buffer parameter is read-only")
- if Scalar::Util::readonly($_[0]);
+ if readonly($_[0]);
$buffer = \$_[0] ;
}
@@ -1130,9 +1057,6 @@ sub read
}
}
}
- elsif (! defined $$buffer) {
- $$buffer = '' ;
- }
return G_EOF if !length *$self->{Pending} && *$self->{EndStream} ;
@@ -1189,6 +1113,7 @@ sub read
*$self->{Pending} = $out_buffer;
$out_buffer = \*$self->{Pending} ;
+ #substr($$buffer, $offset) = substr($$out_buffer, 0, $length, '') ;
substr($$buffer, $offset) = substr($$out_buffer, 0, $length) ;
substr($$out_buffer, 0, $length) = '' ;
@@ -1198,78 +1123,70 @@ sub read
sub _getline
{
my $self = shift ;
- my $status = 0 ;
# Slurp Mode
if ( ! defined $/ ) {
my $data ;
- 1 while ($status = $self->read($data)) > 0 ;
- return ($status, \$data);
+ 1 while $self->read($data) > 0 ;
+ return \$data ;
}
# Record Mode
if ( ref $/ eq 'SCALAR' && ${$/} =~ /^\d+$/ && ${$/} > 0) {
my $reclen = ${$/} ;
my $data ;
- $status = $self->read($data, $reclen) ;
- return ($status, \$data);
+ $self->read($data, $reclen) ;
+ return \$data ;
}
# Paragraph Mode
if ( ! length $/ ) {
my $paragraph ;
- while (($status = $self->read($paragraph)) > 0 ) {
+ while ($self->read($paragraph) > 0 ) {
if ($paragraph =~ s/^(.*?\n\n+)//s) {
*$self->{Pending} = $paragraph ;
my $par = $1 ;
- return (1, \$par);
+ return \$par ;
}
}
- return ($status, \$paragraph);
+ return \$paragraph;
}
# $/ isn't empty, or a reference, so it's Line Mode.
{
my $line ;
+ my $offset;
my $p = \*$self->{Pending} ;
- while (($status = $self->read($line)) > 0 ) {
+
+ if (length(*$self->{Pending}) &&
+ ($offset = index(*$self->{Pending}, $/)) >=0) {
+ my $l = substr(*$self->{Pending}, 0, $offset + length $/ );
+ substr(*$self->{Pending}, 0, $offset + length $/) = '';
+ return \$l;
+ }
+
+ while ($self->read($line) > 0 ) {
my $offset = index($line, $/);
if ($offset >= 0) {
my $l = substr($line, 0, $offset + length $/ );
substr($line, 0, $offset + length $/) = '';
$$p = $line;
- return (1, \$l);
+ return \$l;
}
}
- return ($status, \$line);
+ return \$line;
}
}
sub getline
{
my $self = shift;
-
- if (defined *$self->{ReadStatus} ) {
- $self->saveErrorString( @{ *$self->{ReadStatus} } );
- delete *$self->{ReadStatus} ;
- return undef;
- }
-
- return undef
- if *$self->{Closed} || (!length *$self->{Pending} && *$self->{EndStream}) ;
-
my $current_append = *$self->{AppendOutput} ;
*$self->{AppendOutput} = 1;
-
- my ($status, $lineref) = $self->_getline();
+ my $lineref = $self->_getline();
+ $. = ++ *$self->{LineNo} if defined $$lineref ;
*$self->{AppendOutput} = $current_append;
-
- return undef
- if $status < 0 || length $$lineref == 0 ;
-
- $. = ++ *$self->{LineNo} ;
-
return $$lineref ;
}
@@ -1363,6 +1280,7 @@ sub close
if (defined *$self->{FH}) {
if ((! *$self->{Handle} || *$self->{AutoClose}) && ! *$self->{StdIO}) {
+ #if ( *$self->{AutoClose}) {
local $.;
$! = 0 ;
$status = *$self->{FH}->close();
@@ -1430,7 +1348,7 @@ sub seek
my $offset = $target - $here ;
my $got;
- while (($got = $self->read(my $buffer, List::Util::min($offset, *$self->{BlockSize})) ) > 0)
+ while (($got = $self->read(my $buffer, min($offset, *$self->{BlockSize})) ) > 0)
{
$offset -= $got;
last if $offset == 0 ;
@@ -1493,6 +1411,7 @@ sub input_line_number
sub _notAvailable
{
my $name = shift ;
+ #return sub { croak "$name Not Available" ; } ;
return sub { croak "$name Not Available: File opened only for intput" ; } ;
}
@@ -1526,13 +1445,13 @@ 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 is to be sub-classed by IO::Uncompress modules.
+purpose if to to be sub-classed by IO::Unompress modules.
=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<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
L<Archive::Tar|Archive::Tar>,
@@ -1548,7 +1467,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2014 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2010 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.