CGI::C...plitter(3pm)
π CGI::Cookie::Splitter π
okay bestie, sit down, we're talking about CGI::Cookie::Splitter β the manual page you're reading rn is CGI::C...plitter(3pm) (the truncation is giving very "my name didn't fit on the bus", iconic honestly) β¨
πΈ NAME πΈ
CGI::Cookie::Splitter β split big cookies into smaller ones. that's it, that's the whole job, and she does it flawlessly π
π VERSION π
version 0.05
π¦ SYNOPSIS π¦
use CGI::Cookie::Splitter;
my $splitter = CGI::Cookie::Splitter->new(
size => 123, # defaults to 4096
);
@small_cookies = $splitter->split( @big_cookies );
@big_cookies = $splitter->join( @small_cookies );
look at that. clean. no notes. π
π DESCRIPTION π
okay so here's the tea: RFC 2109 says the smallest cookie size a client is expected to support is 4096 bytes. that number has basically become the standard, and if your server is out here yeeting cookies bigger than that, it's considered a no-no. like, the vibe check has been failed, fr fr π
this module hands you a pretty simple interface for generating small cookies that stay under a certain limit, without wasting too much effort. low effort, high reward, main character energy π
β¨ METHODS β¨
π new
$splitter = CGI::Cookie::Splitter->new(%params)
the only parameter supported right now is size. it defaults to 4096. that's the whole constructor. she's low maintenance π«Ά
π split
@cookies = $splitter->split(@cookies)
this method takes a list of CGI::Cookie objects (or lookalikes β we don't gatekeep, if it walks like a cookie and talks like a cookie, we'll work with it π
) and returns a list of CGI::Cookies.
whenever an object shows up whose total size is bigger than the limit you set at construction time, it gets replaced in the result list with several objects of the same class. those new ones get assigned serial names, and they have a smaller size and the same domain/path/expires/secure parameters. so nothing important gets lost in the glow-up, periodt.
π join
$cookie = $splitter->join(@cookies)
this is the inverse of split. gluing the little guys back into one big guy. π§
π should_split
$splitter->should_split($cookie)
whether or not the cookie should be split. the vibe check, but for cookies. π
π mangle_name_next
$splitter->mangle_name_next($name)
π mangle_name
$splitter->mangle_name($name, $index)
π demangle_name
$splitter->demangle_name($mangled_name)
these methods encapsulate a name mangling scheme for changing the cookie names to allow a 1:n relationship. one name, many cookies. she contains multitudes πΈ
β οΈ bestie listen β the default mangling behavior is not 100% safe, because cookies with a safe size are not mangled. not a drill, just a fact, say it with me π
as long as your cookie names don't start with the substring "_bigcookie_" you should be OK ;-) π
demangles name, increments the index and remangles. yes that's a little chaotic. no we're not changing it.
π SUBCLASSING π
this module is designed to be easily subclassed... if you need to split cookies using a different criteria then you should look into that. go off, build your own, I support you π
π SEE ALSO π
CGI::CookieCGI::Simple::Cookie- <http://www.cookiecutter.com/>
- <http://perlcabal.org/~gaal/metapatch/images/copper-moose-cutter.jpg>
- RFC 2109 <https://www.ietf.org/rfc/rfc2109.txt>
the copper moose cutter image is genuinely essential reading btw, iykyk π¦
π AUTHOR π
ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman) <nothingmuch@woobling.org>
πΈ CONTRIBUTORS πΈ
- Karen Etheridge <ether@cpan.org>
- Shlomi Fish <shlomif@cpan.org>
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2006 by ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman).
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay π
okay that's the whole page bestie, go forth and split responsibly πβ¨
perl v5.34.0 Β· 2022-06-09 Β· CGI::C...plitter(3pm) β that's the version and date stamp from the footer, love that for us, mwah πππ«Ά
π¦ where this page comes from
- debian bookworm: libcgi-cookie-splitter-perl 0.05-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcgi-cookie-splitter-perl 0.05-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcgi-cookie-splitter-perl 0.05-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcgi-cookie-splitter-perl 0.05-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcgi-cookie-splitter-perl 0.05-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