Session/Store/Cache.pm

filter: Statementstmt 100% 27 / 27 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 9 / 9 Podpod 100% 4 / 4 totaltotal 80.0% 44 / 55 CC 5 SCAR 13.2
CC
5
Cov
82%
new
8.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.7
« Session/Store/DBI.pm ↑ Summary Middleware/Session/Cookie.pm »
1 package Plack::Session::Store::Cache;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 our $VERSION = '0.36';
6 3 our $AUTHORITY = 'cpan:STEVAN';
7  
8 3 ▶use Scalar::Util qw[ blessed ];
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 ▶use parent 'Plack::Session::Store';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 3 ▶use Plack::Util::Accessor qw[ cache ];
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 ▶sub new {
Subroutine new: called CC=5 SCAR=20.9
Pod documented
15 2 my ($class, %params) = @_;
16  
17 die('cache require get, set and remove method.')
18 unless blessed $params{cache}
19 && $params{cache}->can('get')
20 && $params{cache}->can('set')
21 2 ▶ && $params{cache}->can('remove');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($params{"cache"}) and $params{"cache"}->can("get") and $params{"cache"}->can("set") and $params{"cache"}->can("remove") 0 2 2
Condition33%3/9
builtin::blessed($params{"cache"}) and $params{"cache"}->can("get") and $params{"cache"}->can("set") and $params{"cache"}->can("remove")
!ll&&!rl&&r
002
builtin::blessed($params{"cache"}) and $params{"cache"}->can("get") and $params{"cache"}->can("set")
!ll&&!rl&&r
002
builtin::blessed($params{"cache"}) and $params{"cache"}->can("get")
!ll&&!rl&&r
002
MC/DC0%0/4
builtin::blessed($params{"cache"}) and $params{"cache"}->can("get") and $params{"cache"}->can("set") and $params{"cache"}->can("remove")
builtin::blessed($params{"cache"}) $params{"cache"}->can("get") $params{"cache"}->can("set") $params{"cache"}->can("remove")
Truth table20%1/5
A and B and C and D
A= builtin::blessed($params{"cache"})B= $params{"cache"}->can("get")C= $params{"cache"}->can("set")D= $params{"cache"}->can("remove")
ABCDresult
0XXX0
10XX0
110X0
11100
11111
22  
23 2 bless { %params } => $class;
24 }
25  
26 12 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
Pod documented
27 12 my ($self, $session_id ) = @_;
28 12 $self->cache->get($session_id);
29 }
30  
31 16 ▶sub store {
Subroutine store: called CC=1 SCAR=0.0
Pod documented
32 16 my ($self, $session_id, $session) = @_;
33 16 $self->cache->set($session_id => $session);
34 }
35  
36 2 ▶sub remove {
Subroutine remove: called CC=1 SCAR=0.0
Pod documented
37 2 my ($self, $session_id) = @_;
38 2 $self->cache->remove($session_id);
39 }
40  
41 3 1;
42  
43 __END__
« Session/Store/DBI.pm ↑ Summary Middleware/Session/Cookie.pm »