CGI::WebGzip - Perl extension for GZipping script output
In PHP, you may write:
ob_start("ob_gzhandler") and get all the output GZip-ed automatically. CGI::WebGzip does the same thing. Is you include this module in the beginning of your program, it whill capture all the output. When the script ends, CGI::WebGzip compresses captured data and send it to browser.
If browser is incompatible with GZip encoding, output will not be captured, and data will not be compressed.
Captures all the script output for deflating. Default compression level is 9 (maximum). Value 0 means no compression.
Flushes the compressed buffer immediately and releases STDOUT capture. Usable in FastCGI environment together with manual
import() call (see synopsis above).
Returns undef if we are in CGI mode, browser supports compression and Compress::Zlib is found. Otherwise returns non-empty diagnostic message.
Returns true if page of this MIME type can be compressed.
Sets the callback function called AFTER compression process, but BEFORE any output. You may print additional headers in this function (for example, set cookies). If this function returns false, compressed data would not be printed later (presume function does it itself). Arguments:
bool callback(string $compressedBody, string $headers, string $originalBody)
Returns previous callback reference.
Sets another compression level. Returns previous.
You may determine if the compression was performed by this function. It returns undef if data has been compressed or non-empty diagnostic message otherwise.
Returns compressed data (additionally analysing headers, if present). In scalar context returns
$compressedBody only. Input headers can be modified, thus this function returns
$status compression feruse message is returned (or undef if everything is OK). This function can be used exactly as PHPs
Compresses the input string and returns result.
None by default.
CGI::WebGzip depends on Compress::Zlib only. If this library is not found, no error messages are generated.
Dmitry Koterov <koterov at cpan dot org>