ZofCMS/Plugin/Cookies.pm

filter: Statementstmt 34.7% 8 / 23 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 2 totaltotal 25.0% 10 / 40 CC 6 SCAR 33.5
CC
6
Cov
25%
process
42.0
new
2.0
BEGIN
1.0
CRAP 28.4
« ZofCMS/Plugin/RandomPasswordGeneratorPurePerl.pm ↑ Summary ZofCMS/Plugin/StyleSwitcher.pm »
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
BranchTrueFalseTotal
if ($template->{"set_cookies"}) 0 0 0
20 0 my $cookies = delete $template->{set_cookies};
21 0 ▶ if ( ref $cookies eq 'HASH' or not ref $cookies->[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $cookies eq "HASH" or not ref $cookies->[0]) 0 0 0
Condition0%0/3
ref $cookies eq "HASH" or not ref $cookies->[0]
l!l&&r!l&&!r
000
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]
ABresult
1X1
011
000
22 0 $cookies = [ $cookies ];
23 }
24 0 for ( @$cookies ) {
25 0 my $cookie;
26 0 ▶ if ( ref eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_ eq 'HASH') { } 0 0 0
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__
« ZofCMS/Plugin/RandomPasswordGeneratorPurePerl.pm ↑ Summary ZofCMS/Plugin/StyleSwitcher.pm »