piyush.shourie has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am not able to verify the cause of error produced by the following code. The deflate method does not raise any errors, but the error returned while inflating is Z_DATA_ERROR (-3)

use Compress::Zlib ; binmode STDIN; binmode STDOUT; my $x = deflateInit() or die "Cannot create a deflation stream\n" ; my $data="This is a test string"; my ($output, $status) ; ($output, $status) = $x->deflate($data) ; ($output, $status) = $x->flush() ; $status == Z_OK or die "deflation failed\n" ; # print $output ; ($rest, $status) = $x->flush() ; $status == Z_OK or die "deflation failed\n" ; $output.=$rest; print $output ; $i = inflateInit() or die "Cannot create a inflation stream\n" ; $status=Z_OK; print "\nInf stream created\n"; $result='a'; while($status == Z_OK) { $temp=$output; print "temp: $temp\n"; $status = $i->inflateSync($output); print "\noutput: $output\n"; ($output1, $status) = $i->inflate($temp) ; $result.=$output1 if $status == Z_OK or $status == Z_STREAM_END ; print "\n-$status"; } die ("inflation failed: " . $result . "\n" . $status) unless $status == Z_STREAM_END ;

This is very urgent. Any help will be highly appreciated.

Thanks,
Piyush

Replies are listed 'Best First'.
Re: error in inflate method of Compress::Zlib module
by Anonymous Monk on Nov 19, 2004 at 08:58 UTC