| 1 | package Plack::Middleware::Session::RemoveCookies; | ||||||||||
| 2 | # ABSTRACT: remove cookies from the requests | ||||||||||
| 3 | |||||||||||
| 4 | 2 | our $VERSION = '0.02'; # VERSION | |||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use Plack::Request; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | ▶ | use HTTP::Headers::Util qw(join_header_words); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 2 | ▶ | use Plack::Util::Accessor 'key'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 2 | ▶ | use parent 'Plack::Middleware'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | sub call { | ||||||||
|
Subroutine
call: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 15 | 1 | my ( $self, $env ) = @_; | |||||||||
| 16 | |||||||||||
| 17 | 1 | ▶ | if ( $env->{'HTTP_COOKIE'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 1 | my $cookie = Plack::Request->new($env)->cookies; | |||||||||
| 19 | 1 | foreach my $c_key ( keys %$cookie ) { | |||||||||
| 20 | 2 | ▶ | delete $cookie->{$c_key} if $c_key =~ $self->key; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | } | ||||||||||
| 22 | 1 | $env->{'plack.cookie.string'} = $env->{'HTTP_COOKIE'} | |||||||||
| 23 | = join_header_words(%$cookie); | ||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 1 | return $self->app->($env); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 2 | 1; | |||||||||
| 30 | |||||||||||
| 31 | __END__ | ||||||||||