| 1 | package App::ZofCMS::Plugin::Cookies; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = '1.001010'; # VERSION | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 0 | ▶ | sub new { return bless {}, shift } | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub process { | ||||||||||||||||||||||||||
|
Subroutine
process: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 0 | my ( $self, $template, $query, $config ) = @_; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | my $cgi = $config->cgi; | |||||||||||||||||||||||||||
| 14 | $template->{d}{cookies} = { | ||||||||||||||||||||||||||||
| 15 | 0 | map +( $_ => $cgi->cookie($_) ), | |||||||||||||||||||||||||||
| 16 | $cgi->cookie | ||||||||||||||||||||||||||||
| 17 | }; | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | if ( $template->{set_cookies} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 0 | my $cookies = delete $template->{set_cookies}; | |||||||||||||||||||||||||||
| 21 | 0 | ▶ | if ( ref $cookies eq 'HASH' or not ref $cookies->[0] ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $cookies eq "HASH" or not ref $cookies->[0]
MC/DC0%0/2
ref $cookies eq "HASH" or not ref $cookies->[0]
ref $cookies eq "HASH"
not ref $cookies->[0]
Truth table0%0/3
A or not(B)
A= ref $cookies eq "HASH"B= not ref $cookies->[0]
| |||||||||||||||||||||||||||||
| 22 | 0 | $cookies = [ $cookies ]; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | 0 | for ( @$cookies ) { | |||||||||||||||||||||||||||
| 25 | 0 | my $cookie; | |||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ( ref eq 'HASH' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 0 | $cookie = $cgi->cookie( %$_ ); | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | else { | ||||||||||||||||||||||||||||
| 30 | 0 | $cookie = $cgi->cookie( -name => $_->[0], -value => $_->[1] ); | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | 0 | print "Set-Cookie: $cookie\n"; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | return; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 1 | 1; | |||||||||||||||||||||||||||
| 40 | __END__ | ||||||||||||||||||||||||||||