blib/lib/Kelp/Exception.pm

filter: Statementstmt 94.4% 17 / 18 Branchbran 100% 4 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 80.0% 4 / 5 Podpod 50.0% 1 / 2 totaltotal 85.2% 29 / 34 CC 4 SCAR 7.0
CC
4
Cov
92%
new
3.0
throw
2.0
__ANON__
1.1
CRAP 2.0
« blib/lib/Kelp/Module/Encoder.pm ↑ Summary blib/lib/Kelp/Routes/Controller.pm »
1 package Kelp::Exception;
2  
3 4 ▶use Kelp::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 0 ▶attr -code => sub { croak 'code is required' };
Subroutine __ANON__: not called CC=1 SCAR=1.2
8  
9 4 attr body => undef;
10  
11 sub new
12 15 ▶{
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
13 15 my ($class, $code, %params) = @_;
14  
15 15 ▶ croak 'Kelp::Exception can only accept 4XX or 5XX codes'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $code and $code =~ /^[45]\d\d$/ 2 13 15
Condition66%2/3
defined $code and $code =~ /^[45]\d\d$/
!ll&&!rl&&r
0213
MC/DC50%1/2
defined $code and $code =~ /^[45]\d\d$/
defined $code $code =~ /^[45]\d\d$/
Truth table66%2/3
A and B
A= defined $codeB= $code =~ /^[45]\d\d$/
ABresult
0X0
100
111
16 unless defined $code && $code =~ /^[45]\d\d$/;
17  
18 13 $params{code} = $code;
19 13 return $class->SUPER::new(%params);
20 }
21  
22 sub throw
23 15 ▶{
Subroutine throw: called CC=2 SCAR=6.9
Pod documented
24 15 my $self = shift;
25 15 ▶ if (!ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $self) 14 1 15
26 14 $self = $self->new(@_);
27 }
28  
29 13 die $self;
30 }
31  
32 4 1;
33  
34 __END__
« blib/lib/Kelp/Module/Encoder.pm ↑ Summary blib/lib/Kelp/Routes/Controller.pm »