OpenInteract2/Cookie.pm

filter: Statementstmt 42.3% 11 / 26 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 31.8% 14 / 44 CC 5 SCAR 27.5
CC
5
Cov
33%
create
30.0
parse
2.0
expire
2.0
CRAP 15.7
« OpenInteract2/Request/Apache2.pm ↑ Summary OpenInteract2/Setup/ReadActionTable.pm »
1 package OpenInteract2::Cookie;
2  
3 # $Id: Cookie.pm,v 1.12 2005/03/17 14:57:58 sjn Exp $
4  
5 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 87 ▶use CGI::Cookie;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 87 ▶use OpenInteract2::Context qw( CTX DEPLOY_URL );
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 87 $OpenInteract2::Cookie::VERSION = sprintf("%d.%02d", q$Revision: 1.12 $ =~ /(\d+)\.(\d+)/);
10  
11 # keys names, values CGI::Cookie objects
12  
13 0 ▶sub parse {
Subroutine parse: not called CC=1 SCAR=6.9
Pod undocumented
14 0 my ( $class, $cookie_header ) = @_;
15 0 return { CGI::Cookie->parse( $cookie_header ) };
16 }
17  
18 0 ▶sub create {
Subroutine create: not called CC=5 SCAR=34.0
Pod undocumented
19 0 my ( $class, $params ) = @_;
20 0 my %cgi_params = ();
21 0 my @cgi_keys = qw( name value expires domain path );
22 0 foreach my $key ( @cgi_keys ) {
23 0 ▶ next unless ( $params->{ $key } );
Branch: 1 branch
BranchTrueFalseTotal
unless $params->{$key} 0 0 0
24 0 $cgi_params{ "-$key" } = $params->{ $key };
25 }
26 0 ▶ $cgi_params{ "-path" } ||= DEPLOY_URL;
Condition0%0/3
$cgi_params{"-path"} ||= DEPLOY_URL()
l!l&&r!l&&!r
000
MC/DC0%0/2
$cgi_params{"-path"} ||= DEPLOY_URL()
$cgi_params{"-path"} DEPLOY_URL()
Truth table0%0/3
A ||= B
A= $cgi_params{"-path"}B= DEPLOY_URL()
ABresult
1X1
011
000
27 0 my $cookie = CGI::Cookie->new( %cgi_params );
28 0 ▶ if ( $params->{HEADER} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->{"HEADER"}) 0 0 0
29 0 CTX->response->cookie( $cookie );
30 }
31 0 return $cookie;
32 }
33  
34 0 ▶sub expire {
Subroutine expire: not called CC=1 SCAR=6.9
Pod undocumented
35 0 my ( $class, $cookie_name ) = @_;
36 0 $class->create({ name => $cookie_name,
37 path => DEPLOY_URL,
38 value => undef,
39 expires => '-3M',
40 HEADER => 'yes' });
41  
42 }
43  
44 87 1;
45  
46 __END__
« OpenInteract2/Request/Apache2.pm ↑ Summary OpenInteract2/Setup/ReadActionTable.pm »