Catalyst-Plugin-Compress

 view release on metacpan or  search on metacpan

lib/Catalyst/Plugin/Compress.pm  view on Meta::CPAN


1;

__END__

=head1 NAME

Catalyst::Plugin::Compress - Compress response

=head1 SYNOPSIS

    use Catalyst qw/Compress/;

or (Catalyst pre Unicode Merge, and If you want to use this plugin with
L<Catalyst::Plugin::Unicode>.)

    use Catalyst qw/
        Unicode
        Compress
    /;

or (Catalyst 5.90080 and later)

    use Catalyst qw/
        Compress
    /;


Remember to specify compression_format with:

    __PACKAGE__->config(
        compression_format => $format,
    );

$format can be either gzip bzip2 zlib or deflate.  bzip2 is B<*only*> supported
by lynx and some other console text-browsers.

=head1 DESCRIPTION

This module combines L<Catalyst::Plugin::Deflate> L<Catalyst::Plugin::Gzip>
L<Catalyst::Plugin::Zlib> into one.

It compress response to [gzip bzip2 zlib deflate] if client supports it.  In other
works the client should send the Accept-Encoding HTTP header with a supported
compression like 'gzip'.

B<NOTE>: If you are using an older version of L<Catalyst> that requires the Unicode
plugin and if you want to use this module with L<Catalyst::Plugin::Unicode>, You
B<MUST> load this plugin B<AFTER> L<Catalyst::Plugin::Unicode>.

    use Catalyst qw/
        Unicode
        Compress
    /;

If you don't, You'll get error which is like:

[error] Caught exception in engine "Wide character in subroutine entry at
/usr/lib/perl5/site_perl/5.8.8/Compress/Zlib.pm line xxx."

If you upgrade to any version of L<Catalyst> 5.90080+ the unicode support has been
integrated into core code and this plugin is designed to work with that.

=head1 INTERNAL METHODS

=head2 should_compress_response

This method determine wether compressing the reponse using this plugin.

=head1 SEE ALSO

L<Catalyst>.

=head1 AUTHOR

Yiyi Hu C<yiyihu@gmail.com>

=head1 LICENSE

This library is free software. You can redistribute it and/or modify it under
the same terms as perl itself.

=cut



( run in 0.713 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )