in reply to Re^3: 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
Thanks again for thinking about it at all, out loud or otherwise. :P
The 32kB is just something I saw somewhere about gzip streams. I don't remember where, I probably shouldn't have mentioned it.
If I do this (assume proper var scoping)–
gunzip \$data => \$out; print $out, $/;
–it will display something like–
<status>connected</status> ?R??0 ????l??????@? +U?ެ??/?%y???p???v?Po#[???-???x? >\'Ϩ??4'?V.6?6?֤~5Y???0???C]?$?@m~OgQ?uǃ8?Y?E?8<?Le?4 +?6??٬&qd?x#1
Amended to–
$collected .= $data; gunzip \$collected, \$out; print $out, $/;
We get (it's ignoring the Accept and returning XML)–
<status>connected</status> <quote> <ask>166.29</ask> <asksz>500</asksz> <bid>166.26</bid> … </quote> ...
And then dies after awhile, it's inconsistent where but never sooner than 5kB in, with an "unexpected end" style message.
Adding this lets it run for—maybe, I didn't let it run that long—forever, but it's still stacking up an ever growing scalar and gunzipping the same data over and over–
$collected .= $data; gunzip \$collected, \$out, MultiStream => 1; print $out, $/;
I expect I will have to come up with seek/tell/truncate kind of solution to keep the data from growing forever that uses the MultiStream to reset itself automatically. Haven't had time to go back to it. I feel like this must be a solved problem and I'm just looking in the wrong place. :|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Uncompress streaming gzip on the fly in LWP::UserAgent/WWW::Mechanize
by pmqs (Friar) on Dec 19, 2018 at 17:17 UTC | |
|
Re^5: Uncompress streaming gzip on the fly in LWP::UserAgent/WWW::Mechanize
by vr (Curate) on Dec 19, 2018 at 19:32 UTC | |
by pmqs (Friar) on Dec 19, 2018 at 22:16 UTC | |
by vr (Curate) on Dec 19, 2018 at 23:09 UTC | |
by pmqs (Friar) on Dec 20, 2018 at 13:52 UTC |