Gideon/Plugin/StrictMode.pm

filter: Statementstmt 26.8% 11 / 41 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 28.5% 2 / 7 Podpod 0.0% 0 / 5 totaltotal 14.7% 13 / 88 CC 11 SCAR 23.7
CC
11
Cov
17%
find
12.0
find_one
12.0
update
12.0
CRAP 10.7
« Gideon/Driver.pm ↑ Summary Gideon/Plugin/Cache.pm »
1 package Gideon::Plugin::StrictMode;
2 {
3 1 $Gideon::Plugin::StrictMode::VERSION = '0.0.3';
4 }
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Gideon::Exceptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 #ABSTRACT: Strict mode Plugin
9  
10 1 extends 'Gideon::Plugin';
11  
12 0 ▶sub find {
Subroutine find: not called CC=3 SCAR=24.8
Pod undocumented
13 0 my ( $self, $target, %query ) = @_;
14  
15 0 my $strict_mode = delete $query{-strict};
16 0 my $result_set = $self->next->find( $target, %query );
17  
18 0 ▶ if ( $strict_mode and scalar @$result_set == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($strict_mode and scalar @$result_set == 0) 0 0 0
Condition0%0/3
$strict_mode and scalar @$result_set == 0
!ll&&!rl&&r
000
MC/DC0%0/2
$strict_mode and scalar @$result_set == 0
$strict_mode scalar @$result_set == 0
Truth table0%0/3
A and B
A= $strict_modeB= scalar @$result_set == 0
ABresult
0X0
100
111
19 0 Gideon::Exception::NotFound->throw;
20 }
21  
22 0 $result_set;
23 }
24  
25 0 ▶sub find_one {
Subroutine find_one: not called CC=3 SCAR=24.8
Pod undocumented
26 0 my ( $self, $target, %query ) = @_;
27  
28 0 my $strict_mode = delete $query{-strict};
29 0 my $result = $self->next->find_one( $target, %query );
30  
31 0 ▶ if ( $strict_mode and not defined $result ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($strict_mode and not defined $result) 0 0 0
Condition0%0/3
$strict_mode and not defined $result
!ll&&!rl&&r
000
MC/DC0%0/2
$strict_mode and not defined $result
$strict_mode not defined $result
Truth table0%0/3
A and not(B)
A= $strict_modeB= not defined $result
ABresult
0X0
100
111
32 0 Gideon::Exception::NotFound->throw;
33 }
34  
35 0 $result;
36 }
37  
38 0 ▶sub update {
Subroutine update: not called CC=3 SCAR=24.8
Pod undocumented
39 0 my ( $self, $target, %changes ) = @_;
40  
41 0 my $strict_mode = delete $changes{-strict};
42 0 my $result = $self->next->update( $target, %changes );
43  
44 0 ▶ if ( $strict_mode and not $result ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($strict_mode and not $result) 0 0 0
Condition0%0/3
$strict_mode and not $result
!ll&&!rl&&r
000
MC/DC0%0/2
$strict_mode and not $result
$strict_mode not $result
Truth table0%0/3
A and not(B)
A= $strict_modeB= not $result
ABresult
0X0
100
111
45 0 Gideon::Exception::UpdateFailure->throw;
46 }
47  
48 0 $result;
49 }
50  
51 0 ▶sub save {
Subroutine save: not called CC=3 SCAR=24.8
Pod undocumented
52 0 my ( $self, $target, %options ) = @_;
53  
54 0 my $strict_mode = delete $options{-strict};
55 0 my $result = $self->next->save($target);
56  
57 0 ▶ if ( $strict_mode and not $result ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($strict_mode and not $result) 0 0 0
Condition0%0/3
$strict_mode and not $result
!ll&&!rl&&r
000
MC/DC0%0/2
$strict_mode and not $result
$strict_mode not $result
Truth table0%0/3
A and not(B)
A= $strict_modeB= not $result
ABresult
0X0
100
111
58 0 Gideon::Exception::SaveFailure->throw;
59 }
60  
61 0 $result;
62 }
63  
64 0 ▶sub remove {
Subroutine remove: not called CC=3 SCAR=24.8
Pod undocumented
65 0 my ( $self, $target, %query ) = @_;
66  
67 0 my $strict_mode = delete $query{-strict};
68 0 my $result = $self->next->remove( $target, %query );
69  
70 0 ▶ if ( $strict_mode and not $result ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($strict_mode and not $result) 0 0 0
Condition0%0/3
$strict_mode and not $result
!ll&&!rl&&r
000
MC/DC0%0/2
$strict_mode and not $result
$strict_mode not $result
Truth table0%0/3
A and not(B)
A= $strict_modeB= not $result
ABresult
0X0
100
111
71 0 Gideon::Exception::RemoveFailure->throw;
72 }
73  
74 0 $result;
75 }
76  
77 1 __PACKAGE__->meta->make_immutable;
78 1 1;
79  
80 __END__
« Gideon/Driver.pm ↑ Summary Gideon/Plugin/Cache.pm »