16 Aug 2015 05:59:52 UTC
- Distribution: CGI-Cookie-Splitter
- Module version: 0.05
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Issues (0)
- Testers (716 / 0 / 0)
- KwaliteeBus factor: 3
- 88.82% Coverage
- License: perl_5
- Perl: v5.6.0
- Activity24 month
- Download (25.97KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- SEE ALSO
- COPYRIGHT AND LICENSE
CGI::Cookie::Splitter - Split big cookies into smaller ones.
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 );
RFC 2109 recommends that the minimal cookie size supported by the client is 4096 bytes. This has become a pretty standard value, and if your server sends larger cookies than that it's considered a no-no.
This module provides a pretty simple interface to generate small cookies that are under a certain limit, without wasting too much effort.
$splitter = CGI::Cookie::Splitter->new(%params)
The only supported parameters right now are
size. It defaults to 4096.
@cookies = $splitter->split(@cookies)
This method accepts a list of CGI::Cookie objects (or lookalikes) and returns a list of CGI::Cookies.
Whenever an object with a total size that is bigger than the limit specified at construction time is encountered it is replaced in the result list with several objects of the same class, which are assigned serial names and have a smaller size and the same domain/path/expires/secure parameters.
$cookie = $splitter->join(@cookies)
This is the inverse of
Whether or not the cookie should be split
These methods encapsulate a name mangling scheme for changing the cookie names to allow a 1:n relationship.
As long as your cookie names don't start with the substring
_bigcookie_you should be OK ;-)
Demangles name, increments the index and remangles.
This module is designed to be easily subclassed... If you need to split cookies using a different criteria then you should look into that.
יובל קוג'מן (Yuval Kogman) <email@example.com>
Karen Etheridge <firstname.lastname@example.org>
Shlomi Fish <email@example.com>
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.
Module Install Instructions
To install CGI::Cookie::Splitter, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install CGI::Cookie::Splitter
For more information on module installation, please visit the detailed CPAN module installation guide.