in reply to Re^5: Uncompress streaming gzip on the fly in LWP::UserAgent/WWW::Mechanize
in thread Solved: Uncompress streaming gzip on the fly in LWP::UserAgent/WWW::Mechanize
It depends. The code in your test script assumes that the input consists of 5 completely distinct gzip data streams. So they will each contain the gzip header, the compressed payload and gzip trailer data. If that is what is actually happening with the WWW::Mechanize application, and the gzip data streams aren't that big, then your approach should be fine.
I'm not convinced that is what is happening in the real application though. The snippet of code below, from earlier, along with the observation that uncompressing $collected resulted in more of the real uncompresed payload data suggests that this is a single gzip data stream
$collected .= $data; gunzip \$collected, \$out; print $out, $/;
If that is the case then IO::Uncompress::Gunzip will only work if you are prepared to read the entire compressed data stream and uncompress the lot in one go. If we are dealing with a potentially infinite compressed data stream, that isn't going to work.
The code I posted that uses Compress::Zlib will uncompresses the data as it gets it, one chunk at a time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Uncompress streaming gzip on the fly in LWP::UserAgent/WWW::Mechanize
by vr (Curate) on Dec 19, 2018 at 23:09 UTC | |
by pmqs (Friar) on Dec 20, 2018 at 13:52 UTC |