blib/lib/Langertha/Holmgang/Error.pm

filter: Statementstmt 85.7% 24 / 28 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 80.0% 8 / 10 Podpod 100% 4 / 4 totaltotal 76.7% 43 / 56 CC 5 SCAR 8.6
CC
5
Cov
76%
caught
4.1
caught
4.1
throw
1.1
CRAP 2.4
« blib/lib/Langertha/Holmgang/Random.pm ↑ Summary blib/lib/Langertha/Holmgang/Suite.pm »
1 package Langertha::Holmgang::Error;
2 # ABSTRACT: A loud refusal of input: the field path and the reason
3  
4 54 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 54 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 54 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 54 ▶use overload '""' => sub { $_[0]->field.': '.$_[0]->reason }, fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
8 54 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 54 our $VERSION = '0.001';
11  
12 54 has field => ( is => 'ro', required => 1 );
13  
14  
15 54 has reason => ( is => 'ro', required => 1 );
16  
17  
18 217 ▶sub throw {
Subroutine throw: called CC=1 SCAR=1.2
Pod documented
19 0 ▶ my ( $class, $field, $reason ) = @_;
Subroutine throw: not called CC=1 SCAR=1.2
Pod documented
20 0 croak $class->new( field => $field, reason => $reason );
21 }
22  
23  
24 181 ▶sub caught {
Subroutine caught: called CC=3 SCAR=14.2
Pod documented
25 0 ▶ my ( $class, $err ) = @_;
Subroutine caught: not called CC=3 SCAR=14.2
Pod documented
26 0 ▶ return blessed $err && $err->isa($class) ? $err : undef;
Branch: 2 branches
BranchTrueFalseTotal
builtin::blessed($err) && $err->isa($class) ? : 170 11 181
builtin::blessed($err) && $err->isa($class) ? : 0 0 0
Condition50%3/6
builtin::blessed($err) and $err->isa($class)
!ll&&!rl&&r
101170
builtin::blessed($err) and $err->isa($class)
!ll&&!rl&&r
000
MC/DC100%2/2
builtin::blessed($err) and $err->isa($class)
builtin::blessed($err) $err->isa($class)
MC/DC0%0/2
builtin::blessed($err) and $err->isa($class)
builtin::blessed($err) $err->isa($class)
Truth table100%3/3
A and B
A= builtin::blessed($err)B= $err->isa($class)
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= builtin::blessed($err)B= $err->isa($class)
ABresult
0X0
100
111
27 }
28  
29  
30 54 __PACKAGE__->meta->make_immutable;
31  
32 __END__
« blib/lib/Langertha/Holmgang/Random.pm ↑ Summary blib/lib/Langertha/Holmgang/Suite.pm »