blib/lib/Net/Airbrake/Error.pm

filter: Statementstmt 100% 22 / 22 Branchbran 100% 8 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 94.5% 35 / 37 SCAR 16.1
CC
5
Cov
100%
BUILDARGS
4.0
to_hash
2.0
BEGIN
1.0
CRAP 5.0
« blib/lib/Net/Airbrake/Request.pm ↑ Summary Build »
1 package Net::Airbrake::Error;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use Class::Tiny qw(type message backtrace);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub BUILDARGS {
9 7 ▶ my $class = shift;
Subroutine BUILDARGS: called CC=4 SCAR=13.9
Pod undocumented
10 7 my ($param) = @_;
11  
12 7 ▶ if (ref $param eq 'HASH') {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $param eq 'HASH') { } 2 5 7
elsif (ref $param) { } 1 4 5
elsif ($param =~ /^(.+) at (.+) line (\d+)\.$/) { } 2 2 4
13 2 return $param;
14 }
15 elsif (ref $param) {
16 1 require Data::Dumper;
17 1 return { type => ref $param, message => Data::Dumper::Dumper($param) };
18 }
19 elsif ($param =~ /^(.+) at (.+) line (\d+)\.$/) {
20 return {
21 2 type => 'CORE::die',
22 message => $1,
23 backtrace => [ { file => $2, line => $3, function => 'N/A' } ],
24 };
25 }
26 else {
27 2 return { type => 'error', message => "$param" };
28 }
29 }
30  
31 sub to_hash {
32 2 ▶ my $self = shift;
Subroutine to_hash: called CC=2 SCAR=6.9
Pod undocumented
33  
34 {
35 type => $self->type,
36 message => $self->message,
37 backtrace => [
38 map {
39 +{
40 file => '' . $_->{file},
41 line => 0 + $_->{line},
42 function => '' . $_->{function},
43 }
44 2 ▶ } @{$self->backtrace || []}
Branch: 1 branch
BranchTrueFalseTotal
$self->backtrace or [] 1 1 2
45 ],
46 };
47 }
48  
49 3 1;
50 __END__
51  
52 =pod
53  
54 =head1 NAME
55  
56 Net::Airbrake::Error - Error
57  
58 =cut
« blib/lib/Net/Airbrake/Request.pm ↑ Summary Build »