in reply to Re^6: uncompress gzip data in a callback(Updated)
in thread uncompress gzip data in a callback

You've missed the WindowsBits option in the constructor and you should also test for Z_STREAM_END in the main loop.

This is how I would write the loop.

#! perl -slw use strict; use Compress::Raw::Zlib; my $o = new Compress::Raw::Zlib::Inflate( WindowBits => WANT_GZIP ); binmode STDIN; my $status; while( read( STDIN, my $in, int( rand 1024 ) ) ) { $status = $o->inflate($in, my $out) ; print $out if $status == Z_OK or $status == Z_STREAM_END ; last if $status != Z_OK ; } die "inflation failed\n" unless $status == Z_STREAM_END ;