MojoX::Encode::Gzip - Gzip a Mojo::Message::Response
use MojoX:Encode::Gzip; # Simple MojoX::Encode::Gzip->new->maybe_gzip($tx); # With options my $gzip = MojoX::Encode::Gzip->new( min_bytes => 600, max_bytes => 600000, ); $success = $gzip->maybe_gzip($tx);
Gzip compress a Mojo::Message::Response if client supports it.
min_bytes
The minumum number of bytes in the body before we would try to gzip it. Trying to gzip really small messages can take extra CPU power on the server and client without saving any times. Defaults to 500.
max_bytes
The maximum number of bytes in the body before we give up on trying gzip it. Gzipping very large messages can delay the response and possibly exhaust system resources. Defaults to 500000.
maybe_gzip
my $success = $gzip->maybe_gzip($tx);
Given a Mojo::Transaction object, possibly gzips transforms the response by gzipping it. Returns true if we gzip it, and undef otherwise. The behavior is modified by the min_bytes and max_bytes attributes.
Currently we only only try to gzip Content-types that start with "text/", or end in "xml" or "javascript", along with "application/json". This may be configurable in the future.
Mark Stosberg, <mark at summersault.com>
<mark at summersault.com>
Please report any bugs or feature requests to bug-mojox-encode-gzip at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MojoX-Encode-Gzip. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-mojox-encode-gzip at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc MojoX::Encode::Gzip
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=MojoX-Encode-Gzip
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/MojoX-Encode-Gzip
CPAN Ratings
http://cpanratings.perl.org/d/MojoX-Encode-Gzip
Search CPAN
http://search.cpan.org/dist/MojoX-Encode-Gzip
Inspired by Catalyst::Plugin::Compress::Gzip
Copyright 2008 Mark Stosberg, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install MojoX::Encode::Gzip, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MojoX::Encode::Gzip
CPAN shell
perl -MCPAN -e shell install MojoX::Encode::Gzip
For more information on module installation, please visit the detailed CPAN module installation guide.