Fallback/Memory.pm

filter: Statementstmt 85.7% 24 / 28 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 3 totaltotal 60.6% 37 / 61 CC 8 SCAR 18.2
CC
8
Cov
69%
SET_ITEM
10.9
_GET
2.1
SET_GROUP
2.0
CRAP 6.2
« Fallback/ConfFile.pm ↑ Summary Fallback/Client.pm »
1 #!/usr/bin/perl -w
2  
3 # set session - item
4 # set session - content
5  
6 # set - item
7 # set - content
8  
9 package Data::Fallback::Memory;
10  
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use Data::Fallback;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 @ISA = qw(Data::Fallback);
16  
17 10 ▶sub get_memory_cache_key {
Subroutine get_memory_cache_key: called CC=1 SCAR=0.0
Pod undocumented
18 10 my $self = shift;
19 10 return $self->get_cache_key('primary_key') . "-" . $self->{item};
20 }
21  
22 5 ▶sub _GET {
Subroutine _GET: called CC=2 SCAR=7.6
23 5 my $self = shift;
24 5 my $return = 0;
25 5 my ($found_in_cache, $content) =
26 $self->check_cache('Memory', 'item', $self->get_memory_cache_key);
27  
28 5 ▶ if($found_in_cache) {
Branch: 1 branch
BranchTrueFalseTotal
if ($found_in_cache) 0 5 5
29 # already set in $content, so we're done
30 0 $self->{update}{item} = $content;
31 0 $return = 1;
32 }
33 5 return $return;
34 }
35  
36 5 ▶sub SET_ITEM {
Subroutine SET_ITEM: called CC=7 SCAR=23.8
Pod undocumented
37 5 my $self = shift;
38 5 my ($key, $value) = ($self->get_memory_cache_key, $self->{update}{item});
39 5 ▶ die "need a \$self->{list_name}" unless( (defined $self->{list_name}) && length $self->{list_name});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"list_name"} and length $self->{"list_name"} 0 5 5
Condition33%1/3
defined $self->{"list_name"} and length $self->{"list_name"}
!ll&&!rl&&r
005
MC/DC0%0/2
defined $self->{"list_name"} and length $self->{"list_name"}
defined $self->{"list_name"} length $self->{"list_name"}
Truth table33%1/3
A and B
A= defined $self->{"list_name"}B= length $self->{"list_name"}
ABresult
0X0
100
111
40 5 ▶ die "need a \$key" unless( (defined $key) && length $key);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key and length $key 0 5 5
Condition33%1/3
defined $key and length $key
!ll&&!rl&&r
005
MC/DC0%0/2
defined $key and length $key
defined $key length $key
Truth table33%1/3
A and B
A= defined $keyB= length $key
ABresult
0X0
100
111
41 5 ▶ die "need a \$value" unless( (defined $value) && length $value);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value and length $value 0 5 5
Condition33%1/3
defined $value and length $value
!ll&&!rl&&r
005
MC/DC0%0/2
defined $value and length $value
defined $value length $value
Truth table33%1/3
A and B
A= defined $valueB= length $value
ABresult
0X0
100
111
42  
43 5 return $self->set_cache('Memory', 'item', $key, $value);
44 }
45  
46 0 ▶sub SET_GROUP {
Subroutine SET_GROUP: not called CC=1 SCAR=6.9
Pod undocumented
47 0 my $self = shift;
48  
49 # can't really set a group in Memory, since the content name is different
50 # at each driver level
51  
52 0 return 1;
53 }
54  
55 1 1;
« Fallback/ConfFile.pm ↑ Summary Fallback/Client.pm »