Cataly...mpress(3pm)

✨ NAME ✨

Catalyst::Plugin::Compress β€” it compresses your response, bestie πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

okay so first things first, you gotta load it:

use Catalyst qw/Compress/;

or, and this is the version you want if Catalyst::Plugin::Unicode is also in the mix:

use Catalyst qw/
    Unicode
    Compress
/;

that second one is specifically for when you wanna use this plugin alongside Catalyst::Plugin::Unicode, just so we're clear 🫢

and do NOT forget to set compression_format, like:

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

$format can be any one of gzip, bzip2, zlib, or deflate. and like, heads up: bzip2 is only supported by lynx and some other console text-browsers. that's it. that's the whole list. no cap 😭


🌸 DESCRIPTION 🌸

this module is basically a three-in-one glow-up: it smooshes Catalyst::Plugin::Deflate, Catalyst::Plugin::Gzip, and Catalyst::Plugin::Zlib into one single plugin. iconic behavior, honestly πŸ’…

it compresses the response to [gzip bzip2 zlib deflate] if the client supports it. vibe check passed, response compressed, slay ✨

NOTE: if you wanna use this module with Catalyst::Plugin::Unicode, you MUST load this plugin AFTER Catalyst::Plugin::Unicode. order matters, bestie, it's giving choreography 🧚
use Catalyst qw/
    Unicode
    Compress
/;

if you don't do it in that order? you'll get an error that looks a lil something like this:

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

and you do not want that. trust πŸ™ˆ


πŸ”₯ INTERNAL METHODS πŸ”₯

πŸ’œ should_compress_response

this method determines whether the response is getting compressed using this plugin. yes, it's literally spelled "wether" in the original and we respect the typo, periodt.


πŸ‘‘ SEE ALSO πŸ‘‘

Catalyst. that's the one. go look at it πŸ¦‹


πŸ’– AUTHOR πŸ’–

Yiyi Hu "yiyihu@gmail.com" β€” thank you for your service, main character 🌟


🌈 LICENSE 🌈

this library is free software. you can redistribute it and/or modify it under the same terms as perl itself. so like, go off, but respectfully πŸ’…


and that's the whole page, bestie!! this one's from perl v5.32.0, dated 2021-01-08 β€” a lil vintage, a lil classic, still serving πŸ’œβœ¨

πŸ“¦ where this page comes from