Session/Driver.pm

filter: Statementstmt 69.7% 23 / 33 Branchbran 80.0% 8 / 10 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 40.0% 4 / 10 Podpod 71.4% 5 / 7 totaltotal 65.0% 41 / 63 CC 7 SCAR 14.3
CC
7
Cov
71%
new
7.4
init
2.0
retrieve
2.0
CRAP 4.2
« Session/Driver/file.pm ↑ Summary Session/Test/Default.pm »
1 package CGI::Session::Driver;
2  
3 24 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 #
5  
6 24 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 24 ▶use CGI::Session::ErrorHandler;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 24 $CGI::Session::Driver::VERSION = '4.43';
10 24 @CGI::Session::Driver::ISA = qw(CGI::Session::ErrorHandler);
11  
12 48 ▶sub new {
Subroutine new: called CC=7 SCAR=20.0
Pod undocumented
13 48 my $class = shift;
14 48 ▶ my $args = shift || {};
Condition50%1/2
shift() || {}
l!l
480
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
15  
16 48 ▶ unless ( ref $args ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $args) 0 48 48
17 0 croak "$class->new(): Invalid argument type passed to driver";
18 }
19  
20 # Set defaults.
21  
22 48 ▶ if (! $args->{TableName}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args->{"TableName"}) 32 16 48
23 32 $args->{TableName} = 'sessions';
24 }
25  
26 48 ▶ if (! $args->{IdColName}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args->{"IdColName"}) 32 16 48
27 32 $args->{IdColName} = 'id';
28 }
29  
30 48 ▶ if (! $args->{DataColName}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args->{"DataColName"}) 32 16 48
31 32 $args->{DataColName} = 'a_session';
32 }
33  
34 # perform a shallow copy of $args, to prevent modification
35 48 my $self = bless ({%$args}, $class);
36 48 ▶ return $self if $self->init();
Branch: 1 branch
BranchTrueFalseTotal
if $self->init 48 0 48
37 0 return $self->set_error( "$class->init() returned false");
38 }
39  
40 0 ▶sub init { 1 }
Subroutine init: not called CC=1 SCAR=6.9
Pod documented
41  
42 0 ▶sub retrieve {
Subroutine retrieve: not called CC=1 SCAR=6.9
Pod documented
43 0 croak "retrieve(): " . ref($_[0]) . " failed to implement this method!";
44 }
45  
46 0 ▶sub store {
Subroutine store: not called CC=1 SCAR=6.9
Pod documented
47 0 croak "store(): " . ref($_[0]) . " failed to implement this method!";
48 }
49  
50 0 ▶sub remove {
Subroutine remove: not called CC=1 SCAR=6.9
Pod documented
51 0 croak "remove(): " . ref($_[0]) . " failed to implement this method!";
52 }
53  
54 0 ▶sub traverse {
Subroutine traverse: not called CC=1 SCAR=6.9
Pod documented
55 0 croak "traverse(): " . ref($_[0]) . " failed to implement this method!";
56 }
57  
58 0 ▶sub dump {
Subroutine dump: not called CC=1 SCAR=6.9
Pod undocumented
59 0 require Data::Dumper;
60 0 my $d = Data::Dumper->new([$_[0]], [ref $_[0]]);
61 0 return $d->Dump;
62 }
63  
64  
65 24 1;
66  
67 __END__;
« Session/Driver/file.pm ↑ Summary Session/Test/Default.pm »