Enbld/Exception.pm

filter: Statementstmt 100% 24 / 24 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 3 totaltotal 89.4% 34 / 38 SCAR 11.0
CC
3
Cov
96%
new
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Enbld/Target/Attribute/TestAction.pm ↑ Summary Enbld/Target/AttributeCollector.pm »
1 package Enbld::Exception;
2  
3 25 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 25 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 25 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 use overload (
9 25 q{""} => \&to_string,
10 fallback => 1,
11 25 ▶ );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub throw {
14 32 ▶ my ( $class, $message, $param ) = @_;
Subroutine throw: called CC=1 SCAR=0.0
Pod undocumented
15  
16 32 die $class->new( $message, $param );
17 }
18  
19 sub new {
20 79 ▶ my ( $class, $message, $param ) = @_;
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
21  
22 79 chomp( $message );
23  
24 79 ▶ if ( $param ) { $message .= "\n" . $param . "\n" };
Branch: 1 branch
BranchTrueFalseTotal
if ($param) 25 54 79
25  
26 79 ▶ my $location = $ENV{HARNESS_ACTIVE} ? Carp::longmess() : Carp::shortmess();
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'HARNESS_ACTIVE'} ? : 79 0 79
27  
28 79 my $self = {
29 message => $message,
30 caller_location => $location,
31 };
32  
33 79 return bless $self, $class;
34 }
35  
36 sub to_string {
37 79 ▶ my $self = shift;
Subroutine to_string: called CC=1 SCAR=0.0
Pod undocumented
38  
39 79 return "ABORT:$self->{message}$self->{caller_location}";
40 }
41  
42 25 1;
« Enbld/Target/Attribute/TestAction.pm ↑ Summary Enbld/Target/AttributeCollector.pm »