Re: Compress::Zlib inflateInit help



In our last episode, the evil Dr. Lacto had captured our hero,
Paul Marquess <paul.marquess@xxxxxxxxxxxxxx>, who said:

The key part I didn't know was you are dealing with a sequence of compressed
RFC 1951 data streams that are each prefixed with a bespoke header. So that
means you need to deal with reading both compressed & non-compressed data
from the socket.

Sorry. I didn't realize that the data and the acquisition of the data
were so badly intertwined.

my $header;
my $header_size = 8 + 4 + 4; # time + sequence + size
while (read($socket, $header, $header_size) == $header_size)
{

my ($time1, $time2, $sequence, $size) = unpack "NNNN", $header;

rawinflate $socket => \$data, InputLength => $size
or die "Cannot uncompress: $RawInflateError\n";
print "$data\n";
}

This is perfect!!!

Thank you so much for your help.

--hymie! http://lactose.homelinux.net/~hymie hymie@xxxxxxxxxxxxxxxxxxxxx
------------------------ Without caffeine for 547 days ------------------------
.