AnyEvent-HTTPD-CookiePatch
view release on metacpan or search on metacpan
Revision history for AnyEvent-HTTPD-CookiePatch
v0.1.0 2013.4.14
First version, released on an unsuspecting world.
Changes
lib/AnyEvent/HTTPD/CookiePatch.pm
Makefile.PL
MANIFEST This list of files
README
t/00-load.t
t/manifest.t
t/pod-coverage.t
t/pod.t
META.yml Module meta-data (added by MakeMaker)
--- #YAML:1.0
name: AnyEvent-HTTPD-CookiePatch
version: v0.1.0
abstract: ~
author:
- Cindy Wang (CindyLinz)
license: Artistic_2_0
distribution_type: module
configure_requires:
ExtUtils::MakeMaker: 0
build_requires:
Test::More: 0
Makefile.PL view on Meta::CPAN
use 5.006;
use strict;
use warnings FATAL => 'all';
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'AnyEvent::HTTPD::CookiePatch',
AUTHOR => q{Cindy Wang (CindyLinz)},
VERSION_FROM => 'lib/AnyEvent/HTTPD/CookiePatch.pm',
ABSTRACT_FROM => 'lib/AnyEvent/HTTPD/CookiePatch.pm',
LICENSE => 'Artistic_2_0',
PL_FILES => {},
MIN_PERL_VERSION => 5.006,
CONFIGURE_REQUIRES => {
'ExtUtils::MakeMaker' => 0,
},
BUILD_REQUIRES => {
'Test::More' => 0,
},
PREREQ_PM => {
version => 0,
'AnyEvent::HTTPD' => 0,
'AnyEvent::HTTPD::SendMultiHeaderPatch' => 0,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'AnyEvent-HTTPD-CookiePatch-*' },
);
AnyEvent-HTTPD-CookiePatch
The README is used to introduce the module and provide instructions on
how to install the module, any machine dependencies it may have (for
example C compilers and installed libraries) and any other information
that should be provided before the module is installed.
A README file is required for CPAN modules since CPAN extracts the README
file from a module distribution so that people browsing the archive
can use it to get an idea of the module's uses. It is usually a good idea
to provide version information here so that people can decide whether
perl Makefile.PL
make
make test
make install
SUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the
perldoc command.
perldoc AnyEvent::HTTPD::CookiePatch
You can also look for information at:
RT, CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=AnyEvent-HTTPD-CookiePatch
AnnoCPAN, Annotated CPAN documentation
http://annocpan.org/dist/AnyEvent-HTTPD-CookiePatch
CPAN Ratings
http://cpanratings.perl.org/d/AnyEvent-HTTPD-CookiePatch
Search CPAN
http://search.cpan.org/dist/AnyEvent-HTTPD-CookiePatch/
LICENSE AND COPYRIGHT
Copyright (C) 2013 Cindy Wang (CindyLinz)
This program is free software; you can redistribute it and/or modify it
under the terms of the the Artistic License (2.0). You may obtain a
copy of the full license at:
lib/AnyEvent/HTTPD/CookiePatch.pm view on Meta::CPAN
package AnyEvent::HTTPD::CookiePatch;
use 5.006;
use strict;
use warnings FATAL => 'all';
=head1 NAME
AnyEvent::HTTPD::CookiePatch -
Patch of AnyEvent::HTTPD for cookie support
=head1 VERSION
Version 0.01
=cut
use version;
our $VERSION = 'v0.1.0';
=head1 SYNOPSIS
# by module injection
use AnyEvent::HTTPD::CookiePatch qw(inject);
# or by inheritance
use AnyEvent::HTTPD::CookiePatch;
my $httpd = AnyEvent::HTTPD->new( request_class => 'AnyEvent::HTTPD::CookiePatch' );
# and then in your handler
sub {
my($httpd, $req) = @_;
# get cookie
my $cookie_a = $req->cookie('a');
# set cookie
$req->cookie('a', 'a_value');
lib/AnyEvent/HTTPD/CookiePatch.pm view on Meta::CPAN
=head2 $value = $req->cookie($name)
Get the cookie
=head2 $req->cookie($name, $value[, $max_age[, $path[, $domain]]])
Set the cookie
=head2 $req->{_set_cookie}
The response header field Set-Cookie's value
=cut
use AnyEvent::HTTPD::SendMultiHeaderPatch;
our @ISA = 'AnyEvent::HTTPD::Request';
sub cookie {
my($req, $name, $value, $max_age, $path, $domain) = @_;
if( defined $value ) { # set cookie
my $fragment = "$name=$value";
lib/AnyEvent/HTTPD/CookiePatch.pm view on Meta::CPAN
sub import {
if( grep { $_ eq 'inject' } @_ ) {
*AnyEvent::HTTPD::Request::cookie = \&cookie;
}
}
=head1 CAVEATS
This module use module L<AnyEvent::HTTPD::SendMultiHeaderPatch> (a hack)
for sending multiple Set-Cookie response header.
=head1 AUTHOR
Cindy Wang (CindyLinz)
=head1 ACKNOWLEDGEMENTS
=head1 LICENSE AND COPYRIGHT
Copyright 2013 Cindy Wang (CindyLinz).
lib/AnyEvent/HTTPD/CookiePatch.pm view on Meta::CPAN
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=cut
1; # End of AnyEvent::HTTPD::CookiePatch
t/00-load.t view on Meta::CPAN
#!perl -T
use 5.006;
use strict;
use warnings FATAL => 'all';
use Test::More;
plan tests => 1;
BEGIN {
use_ok( 'AnyEvent::HTTPD::CookiePatch' ) || print "Bail out!\n";
}
diag( "Testing AnyEvent::HTTPD::CookiePatch $AnyEvent::HTTPD::CookiePatch::VERSION, Perl $], $^X" );
( run in 0.506 second using v1.01-cache-2.11-cpan-e9199f4ba4c )