view release on metacpan or search on metacpan
CONTRIBUTING view on Meta::CPAN
$ prove -l
$ prove -lv t/some_test_file.t
$ prove -lvr t/
In most cases, 'prove' is entirely sufficent for you to test any
patches you have.
You may need to satisfy some dependencies. The easiest way to satisfy
dependencies is to install the last release -- this is available at
https://metacpan.org/release/CGI-Cookie-Splitter.
If you use cpanminus, you can do it without downloading the tarball first:
$ cpanm --reinstall --installdeps --with-recommends CGI::Cookie::Splitter
Dist::Zilla is a very powerful authoring tool, but requires a number of
author-specific plugins. If you would like to use it for contributing,
install it from CPAN, then run one of the following commands, depending on
your CPAN client:
$ cpan `dzil authordeps --missing`
or
$ dzil authordeps --missing | cpanm
CONTRIBUTING view on Meta::CPAN
Or, you can use the 'dzil stale' command to install all requirements at once:
$ cpan Dist::Zilla::App::Command::stale
$ cpan `dzil stale --all`
or
$ cpanm Dist::Zilla::App::Command::stale
$ dzil stale --all | cpanm
You can also do this via cpanm directly:
$ cpanm --reinstall --installdeps --with-develop --with-recommends CGI::Cookie::Splitter
Once installed, here are some dzil commands you might try:
$ dzil build
$ dzil test
$ dzil test --release
$ dzil xtest
$ dzil listdeps --json
$ dzil build --notgz
You can learn more about Dist::Zilla at http://dzil.org/.
The code for this distribution is hosted at GitHub. The repository is:
https://github.com/karenetheridge/CGI-Cookie-Splitter
You can submit code changes by forking the repository, pushing your code
changes to your clone, and then submitting a pull request. Detailed
instructions for doing that is available here:
https://help.github.com/articles/creating-a-pull-request
If you have found a bug, but do not have an accompanying patch to fix it, you
can submit an issue report here:
https://rt.cpan.org/Public/Dist/Display.html?Name=CGI-Cookie-Splitter
or via bug-CGI-Cookie-Splitter@rt.cpan.org.
This is a good place to send your questions about the usage of this distribution.
If you send me a patch or pull request, your name and email address will be
included in the documentation as a contributor (using the attribution on the
commit or patch), unless you specifically request for it not to be. If you
wish to be listed under a different name or address, you should submit a pull
request to the .mailmap file to contain the correct mapping.
This file was generated via Dist::Zilla::Plugin::GenerateFile::ShareDir 0.006 from a
Revision history for CGI-Cookie-Splitter
0.05 2015-08-16 05:58:41Z
- bump namespace::clean prereq to guarantee needed Package::Stash
interfaces
0.04 2014-02-16 20:05:57Z
- convert to Dist::Zilla, with more metadata
0.03 2014-02-03 01:12:11Z
- fix test failures due to hash randomization (RT#81612), and some
This is the Perl distribution CGI-Cookie-Splitter.
Installing CGI-Cookie-Splitter is straightforward.
## Installation with cpanm
If you have cpanm, you only need one line:
% cpanm CGI::Cookie::Splitter
If you are installing into a system-wide directory, you may need to pass the
"-S" flag to cpanm, which uses sudo to install the module:
% cpanm -S CGI::Cookie::Splitter
## Installing with the CPAN shell
Alternatively, if your CPAN shell is set up, you should just be able to do:
% cpan CGI::Cookie::Splitter
## Manual installation
As a last resort, you can manually install it. Download the tarball, untar it,
then build it:
% perl Makefile.PL
% make && make test
Then install it:
% make install
If you are installing into a system-wide directory, you may need to run:
% sudo make install
## Documentation
CGI-Cookie-Splitter documentation is available as POD.
You can run perldoc from a shell to read the documentation:
% perldoc CGI::Cookie::Splitter
CONTRIBUTING
Changes
INSTALL
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
dist.ini
lib/CGI/Cookie/Splitter.pm
t/00-report-prereqs.dd
t/00-report-prereqs.t
t/basic.t
xt/author/00-compile.t
xt/author/clean-namespaces.t
xt/author/eol.t
xt/author/kwalitee.t
xt/author/mojibake.t
xt/author/no-tabs.t
xt/author/pod-spell.t
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 5.039, CPAN::Meta::Converter version 2.150005",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "CGI-Cookie-Splitter",
"no_index" : {
"directory" : [
"t",
"xt"
]
},
"prereqs" : {
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0",
"requires" : {
"ExtUtils::MakeMaker" : "0",
"File::Spec" : "0",
"Test::More" : "0",
"ok" : "0",
"perl" : "5.006"
}
}
},
"provides" : {
"CGI::Cookie::Splitter" : {
"file" : "lib/CGI/Cookie/Splitter.pm",
"version" : "0.05"
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"mailto" : "bug-CGI-Cookie-Splitter@rt.cpan.org",
"web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=CGI-Cookie-Splitter"
},
"homepage" : "https://github.com/karenetheridge/CGI-Cookie-Splitter",
"repository" : {
"type" : "git",
"url" : "https://github.com/karenetheridge/CGI-Cookie-Splitter.git",
"web" : "https://github.com/karenetheridge/CGI-Cookie-Splitter"
}
},
"version" : "0.05",
"x_Dist_Zilla" : {
"perl" : {
"version" : "5.023001"
},
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::Prereqs",
},
{
"class" : "Dist::Zilla::Plugin::AutoMetaResources",
"name" : "@Author::ETHER/AutoMetaResources",
"version" : "1.21"
},
{
"class" : "Dist::Zilla::Plugin::AuthorityFromModule",
"config" : {
"Dist::Zilla::Plugin::AuthorityFromModule" : {
"module" : "CGI::Cookie::Splitter"
},
"Dist::Zilla::Role::ModuleMetadata" : {
"Module::Metadata" : "1.000027",
"version" : "0.003"
}
},
"name" : "@Author::ETHER/AuthorityFromModule",
"version" : "0.006"
},
{
],
"zilla" : {
"class" : "Dist::Zilla::Dist::Builder",
"config" : {
"is_trial" : "0"
},
"version" : "5.039"
}
},
"x_authority" : "cpan:NUFFIN",
"x_authority_from_module" : "CGI::Cookie::Splitter",
"x_contributors" : [
"Karen Etheridge <ether@cpan.org>",
"Shlomi Fish <shlomif@cpan.org>"
],
"x_permissions_from_module" : "CGI::Cookie::Splitter",
"x_static_install" : 1
}
perl: '5.006'
configure_requires:
ExtUtils::MakeMaker: '0'
perl: '5.006'
dynamic_config: 0
generated_by: 'Dist::Zilla version 5.039, CPAN::Meta::Converter version 2.150005'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: CGI-Cookie-Splitter
no_index:
directory:
- t
- xt
provides:
CGI::Cookie::Splitter:
file: lib/CGI/Cookie/Splitter.pm
version: '0.05'
requires:
CGI::Simple::Util: '0'
Carp: '0'
Scalar::Util: '0'
namespace::clean: '0.19'
perl: '5.006'
strict: '0'
warnings: '0'
resources:
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=CGI-Cookie-Splitter
homepage: https://github.com/karenetheridge/CGI-Cookie-Splitter
repository: https://github.com/karenetheridge/CGI-Cookie-Splitter.git
version: '0.05'
x_Dist_Zilla:
perl:
version: '5.023001'
plugins:
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: develop
name: '@Author::ETHER/GithubMeta'
version: '0.54'
-
class: Dist::Zilla::Plugin::AutoMetaResources
name: '@Author::ETHER/AutoMetaResources'
version: '1.21'
-
class: Dist::Zilla::Plugin::AuthorityFromModule
config:
Dist::Zilla::Plugin::AuthorityFromModule:
module: CGI::Cookie::Splitter
Dist::Zilla::Role::ModuleMetadata:
Module::Metadata: '1.000027'
version: '0.003'
name: '@Author::ETHER/AuthorityFromModule'
version: '0.006'
-
class: Dist::Zilla::Plugin::Authority
name: '@Author::ETHER/Authority'
version: '1.009'
-
-
class: Dist::Zilla::Plugin::VerifyPhases
name: '@Author::ETHER/PHASE VERIFICATION'
version: '0.013'
zilla:
class: Dist::Zilla::Dist::Builder
config:
is_trial: '0'
version: '5.039'
x_authority: cpan:NUFFIN
x_authority_from_module: CGI::Cookie::Splitter
x_contributors:
- 'Karen Etheridge <ether@cpan.org>'
- 'Shlomi Fish <shlomif@cpan.org>'
x_permissions_from_module: CGI::Cookie::Splitter
x_static_install: 1
Makefile.PL view on Meta::CPAN
use 5.006;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "Split big cookies into smaller ones.",
"AUTHOR" => "\x{5d9}\x{5d5}\x{5d1}\x{5dc} \x{5e7}\x{5d5}\x{5d2}'\x{5de}\x{5df} (Yuval Kogman) <nothingmuch\@woobling.org>",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "CGI-Cookie-Splitter",
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.006",
"NAME" => "CGI::Cookie::Splitter",
"PREREQ_PM" => {
"CGI::Simple::Util" => 0,
"Carp" => 0,
"Scalar::Util" => 0,
"namespace::clean" => "0.19",
"strict" => 0,
"warnings" => 0
},
"TEST_REQUIRES" => {
"ExtUtils::MakeMaker" => 0,
This archive contains the distribution CGI-Cookie-Splitter,
version 0.05:
Split big cookies into smaller ones.
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.
name = CGI-Cookie-Splitter
author = ×××× ×§××'×× (Yuval Kogman) <nothingmuch@woobling.org>
license = Perl_5
copyright_holder = ×××× ×§××'×× (Yuval Kogman)
copyright_year = 2006
[@Author::ETHER]
:version = 0.094
installer = MakeMaker ; stay 5.6-friendly
Authority.authority = cpan:NUFFIN
Test::MinimumVersion.max_target_perl = 5.006
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
package CGI::Cookie::Splitter; # git description: v0.04-15-g9f9f932
# ABSTRACT: Split big cookies into smaller ones.
our $VERSION = '0.05';
use strict;
use warnings;
use Scalar::Util qw/blessed/;
use CGI::Simple::Util qw/escape unescape/;
use Carp qw/croak/;
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
}
sub do_split_cookie {
my ( $self, $head ) = @_;
my $tail = $self->new_cookie( $head, value => '', name => $self->mangle_name_next( $head->name ) );
my $max_value_size = $self->size - ( $self->cookie_size( $head ) - length( escape($head->value) ) );
$max_value_size -= 30; # account for overhead the cookie serializer might add
die "Internal math error, please file a bug for CGI::Cookie::Splitter: max size should be > 0, but is $max_value_size (perhaps other attrs are too big?)"
unless ( $max_value_size > 0 );
my ( $head_v, $tail_v ) = $self->split_value( $max_value_size, $head->value );
$head->value( $head_v );
$tail->value( $tail_v );
die "Internal math error, please file a bug for CGI::Cookie::Splitter"
unless $self->cookie_size( $head ) <= $self->size; # 10 is not enough overhead
return $head unless $tail_v;
return ( $head, $self->do_split_cookie( $tail ) );
}
sub split_value {
my ( $self, $max_size, $value ) = @_;
my $adjusted_size = $max_size;
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
split_value: {
croak "Can't reduce the size of the cookie anymore (adjusted = $adjusted_size, max = $max_size)" unless $adjusted_size > 0;
$head = substr( $value, 0, $adjusted_size );
$tail = substr( $value, $adjusted_size );
if ( length(my $escaped = escape($head)) > $max_size ) {
my $adjustment = int( ( length($escaped) - length($head) ) / 3 ) + 1;
die "Internal math error, please file a bug for CGI::Cookie::Splitter"
unless $adjustment;
$adjusted_size -= $adjustment;
redo split_value;
}
}
return ( $head, $tail );
}
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
__PACKAGE__;
__END__
=pod
=encoding UTF-8
=head1 NAME
CGI::Cookie::Splitter - Split big cookies into smaller ones.
=head1 VERSION
version 0.05
=head1 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 );
=head1 DESCRIPTION
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.
=head1 METHODS
=head2 new
$splitter = CGI::Cookie::Splitter->new(%params)
The only supported parameters right now are C<size>. It defaults to 4096.
=head2 split
@cookies = $splitter->split(@cookies)
This method accepts a list of CGI::Cookie objects (or lookalikes) and returns
a list of L<CGI::Cookie>s.
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.
=head2 join
$cookie = $splitter->join(@cookies)
lib/CGI/Cookie/Splitter.pm view on Meta::CPAN
This module is designed to be easily subclassed... If you need to split cookies
using a different criteria then you should look into that.
=head1 SEE ALSO
=over 4
=item *
L<CGI::Cookie>
=item *
L<CGI::Simple::Cookie>
=item *
L<http://www.cookiecutter.com/>
=item *
L<http://perlcabal.org/~gaal/metapatch/images/copper-moose-cutter.jpg>
=item *
use strict;
use warnings;
use Test::More;
use ok "CGI::Cookie::Splitter";
my @cookie_classes = grep { eval "require $_; 1" } qw/CGI::Simple::Cookie CGI::Cookie/;
my @cases = ( # big numbers are used to mask the overhead of the other fields
{
size_limit => 4096,
num_cookies => 1,
cookie => {
-name => "a",
-value => [ qw/foo bar gorch baz/ ],
-damain => "www.example.com",
-path => "/foo",
},
},
);
foreach my $class ( @cookie_classes ) {
foreach my $case ( @cases ) {
my ( $size_limit, $num_cookies ) = @{ $case }{qw/size_limit num_cookies/};
my $big = $class->new(%{ $case->{cookie} });
can_ok( "CGI::Cookie::Splitter", "new" );
my $splitter = CGI::Cookie::Splitter->new( size => $size_limit ); # 50 is padding for the other attrs
isa_ok( $splitter, "CGI::Cookie::Splitter" );
can_ok( $splitter, "split" );
my @small = $splitter->split( $big );
is( scalar(@small), $num_cookies, "returned several smaller cookies" );
my $i = 0;
foreach my $cookie ( @small ) {
cmp_ok( length($cookie->as_string), "<=", $size_limit, "cookie size is under specified limit" );
is( scalar(@big), 1, "one big cookie from small cookies" );
foreach my $field ( qw/name value domain path secure/ ) {
is_deeply( [ $big[0]->$field ], [ $big->$field ], "'$field' is the same" );
}
}
my @all_cookies = map { $class->new( %{ $_->{cookie} } ) } @cases;
my $splitter = CGI::Cookie::Splitter->new;
my @split = $splitter->split( @all_cookies );
foreach my $cookie ( @split ) {
cmp_ok( length($cookie->as_string), "<=", 4096, "cookie size is under specified limit" );
};
my @all_joined = $splitter->join( @split );
is( scalar(@all_joined), scalar(@all_cookies), "count is the same after join" );
xt/author/00-compile.t view on Meta::CPAN
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054
use Test::More 0.94;
plan tests => 2;
my @module_files = (
'CGI/Cookie/Splitter.pm'
);
# no fake home requested
my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
use File::Spec;
use IPC::Open3;
xt/author/eol.t view on Meta::CPAN
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::EOL 0.18
use Test::More 0.88;
use Test::EOL;
my @files = (
'lib/CGI/Cookie/Splitter.pm',
't/00-report-prereqs.dd',
't/00-report-prereqs.t',
't/basic.t',
'xt/author/00-compile.t',
'xt/author/clean-namespaces.t',
'xt/author/eol.t',
'xt/author/kwalitee.t',
'xt/author/mojibake.t',
'xt/author/no-tabs.t',
'xt/author/pod-spell.t',
xt/author/no-tabs.t view on Meta::CPAN
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15
use Test::More 0.88;
use Test::NoTabs;
my @files = (
'lib/CGI/Cookie/Splitter.pm',
't/00-report-prereqs.dd',
't/00-report-prereqs.t',
't/basic.t',
'xt/author/00-compile.t',
'xt/author/clean-namespaces.t',
'xt/author/eol.t',
'xt/author/kwalitee.t',
'xt/author/mojibake.t',
'xt/author/no-tabs.t',
'xt/author/pod-spell.t',
xt/author/pod-spell.t view on Meta::CPAN
Kogman
nothingmuch
Karen
Etheridge
ether
Shlomi
Fish
shlomif
lib
CGI
Cookie
Splitter