CGI::C...eHandle(3pm)
π CGI::Compress::Gzip::FileHandle π
okay so bestie, welcome to CGI::Compress::Gzip::FileHandle (3pm) β yes the name is a whole mouthful, we know, but she's a helper package for CGI::Compress::Gzip and she's lowkey doing the most important job in the whole operation. π
β¨ NAME β¨
CGI::Compress::Gzip::FileHandle β the CGI::Compress::Gzip helper package π¦
π LICENSE π
Copyright 2006-2007 Clotho Advanced Media, Inc., <cpan@clotho.com> π
Copyright 2007-2008 Chris Dolan <cdolan@cpan.org> π
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. periodt. β¨
πΈ SYNOPSIS πΈ
ok so you don't actually use this one directly, but here's the vibe of how the big sister module gets used:
use CGI::Compress::Gzip;
my $cgi = new CGI::Compress::Gzip;
print $cgi->header();
print "<html> ...";
like, that's the whole point. print your stuff, it comes out compressed. iconic. π
π« DESCRIPTION π«
This is intended for internal use only! Use CGI::Compress::Gzip instead. π¨ like genuinely bestie, don't touch this one directly, she's not for you, she's for the machine.
This CGI::Compress::Gzip helper class subclasses IO::Zlib. She exists for one very specific reason: to make sure that output is not compressed until the CGI header is emitted. the way that timing matters hereβ¦ π
So this filehandle delays the ignition of the zlib filter until it sees the exact same header generated by CGI::Compress::Gzip::header() pass through its WRITE() method. no cap. it's watching. π
β οΈ and if you change the header before printing it? this class will throw an exception. so don't do that. fr fr. π
This class holds one global variable representing the previous default filehandle used before the gzip filter is put in place. That filehandle β usually STDOUT β is replaced after the gzip stream finishes, which is usually when the CGI object goes out of scope and is destroyed. π«Ά
π§ FUNCTIONS π§
π OPEN π
Overrides IO::Zlib::OPEN. This method doesn't actually do anything β she's just storing her arguments for a later call to SUPER::OPEN in WRITE(). π
The reason? We may not have seen the header yet, so we don't yet know whether to compress output. main character energy: wait for the signal. β
π WRITE buffer, length, offset π
Emit the uncompressed header followed by the compressed body. slay. π₯
π CLOSE π
Flush the compressed output. bye bestie, out it goes. β¨
π AUTHOR π
Clotho Advanced Media, cpan@clotho.com π
Primary developer: Chris Dolan π§βπ»
and that's the whole page, bestie!! π this was perl v5.34.0, dated 2022-06-09, from the CGI::C...eHandle(3pm) manual β go forth and let CGI::Compress::Gzip do the actual work, ily, mwah ππ¦β¨
π¦ where this page comes from
- debian bookworm: libcgi-compress-gzip-perl 1.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcgi-compress-gzip-perl 1.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcgi-compress-gzip-perl 1.03-3 Β· 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