WWW::M...::GZip(3pm)
π WWW::Mechanize::GZip β the Perl doc page, bestie edition π
okay so this is WWW::M...::GZip(3pm), a User Contributed Perl Documentation page, and I am so excited to walk you through it because it's genuinely such a little cutie π
β¨ NAME β¨
WWW::Mechanize::GZip β it tries to fetch webpages with gzip-compression π¦
β¨ VERSION β¨
Version 0.14 π
β¨ SYNOPSIS β¨
bestie here's the whole vibe, copy-paste and go:
use WWW::Mechanize::GZip;
my $mech = WWW::Mechanize::GZip->new();
my $response = $mech->get( $url );
print "x-content-length (before unzip) = ", $response->header('x-content-length');
print "content-length (after unzip) = ", $response->header('content-length');
like. look at those headers. before the unzip vs after</... ok wait, after the unzip. the glow-up is REAL πβ¨
β¨ DESCRIPTION β¨
So the whole thing with WWW::Mechanize::GZip is that it tries to fetch a URL by asking the webserver for gzip-compression. Rude not to ask, honestly. π
And if the response comes back with a header saying 'Content-Encoding: gzip', it decompresses that response so you get the original (uncompressed) content back. π«Ά
This module is here to help reduce bandwidth when fetching webpages β if the webserver supports it. And if the webserver does not support gzip-compression? Then no decompression gets made. Simple as that, no drama. π
Also important: this module is a direct subclass of WWW::Mechanize π which means it will support any methods provided by WWW::Mechanize. everything. all of them. iconic behaviour fr fr.
The decompression itself is handled by Compress::Zlib::memGunzip. shoutout to them, they're doing the actual heavy lifting. β
πΈ METHODS πΈ
π« prepare_request
Adds 'Accept-Encoding' => 'gzip' to the outgoing HTTP-headers before sending. it's giving "manifesting the gzip" energy. β¨
π« send_request
Unzips the response-body if 'content-encoding' is 'gzip', and corrects 'content-length' to the unzipped content-length. so the math is mathing at the end, not the beginning. π§
β¨ SEE ALSO β¨
- WWW::Mechanize
- Compress::Zlib
go read those too bestie, iykyk π
β¨ AUTHOR β¨
Peter Giessner "cardb@planet-elektronik.de" π«Ά
β¨ LICENCE AND COPYRIGHT β¨
Copyright (c) 2007, Peter Giessner "cardb@planet-elektronik.de". All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. πβ¨
fr fr, "same terms as Perl itself" β that's the whole license, no cap. π
and that's the page!! perl v5.36.0, dated 2022-12-12, and the whole thing lives under the manual name WWW::M...::GZip(3pm). mwah, slay, go fetch some gzipped pages responsibly π ππ¦
π¦ where this page comes from
- debian bookworm: libwww-mechanize-gzip-perl 0.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libwww-mechanize-gzip-perl 0.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libwww-mechanize-gzip-perl 0.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libwww-mechanize-gzip-perl 0.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libwww-mechanize-gzip-perl 0.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms