web/cgi-bin/yatt.lib/YATT/Exception.pm

filter: Statementstmt 73.5% 39 / 53 Branchbran 30.0% 9 / 30 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 71.4% 10 / 14 Podpod 0.0% 0 / 7 totaltotal 44.6% 58 / 130 CC 22 SCAR 28.4
CC
22
Cov
48%
can_retry
56.0
is_normal_end
20.0
title
12.0
CRAP 17.1
« blib/lib/YATT/Toplevel/Server.pm ↑ Summary web/cgi-bin/yatt.lib/YATT/Util/Enum.pm »
1 package YATT::Exception;
2 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 7 ▶use warnings qw(FATAL all NONFATAL misc);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use base qw(YATT::Class::Configurable);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 ▶BEGIN {require Exporter; *import = \&Exporter::import}
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 7 ▶use overload '""' => 'string';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub Exception () {__PACKAGE__}
10  
11 7 our @EXPORT_OK = qw(Exception is_normal_end can_retry);
12 7 our @EXPORT = @EXPORT_OK;
13  
14 7 ▶use YATT::LRXML::Node qw(stringify_node);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 7 ▶use YATT::Fields qw(cf_normal cf_error
Subroutine BEGIN: called CC=1 SCAR=0.0
17 cf_caller
18 cf_other
19 cf_retry
20 cf_node_obj cf_node cf_file cf_line
21 cf_error_title
22 cf_error_fmt
23 cf_error_param
24 cf_original_error
25 7 );
26 # cf_phase cf_target
27  
28 0 ▶sub title {
Subroutine title: not called CC=3 SCAR=24.8
Pod undocumented
29 0 (my MY $err) = @_;
30 0 ▶ $err->{cf_error_title} || do {
Branch: 1 branch
BranchTrueFalseTotal
$err->{"cf_error_title"} or do { my $msg = $err->simple; $msg =~ s/[\(:\n].*// if defined $msg; $msg } 0 0 0
31 0 my $msg = $err->simple;
32 0 ▶ $msg =~ s/[\(:\n].*// if defined $msg;
Branch: 1 branch
BranchTrueFalseTotal
if defined $msg 0 0 0
33 0 $msg;
34 };
35 }
36  
37 37 ▶sub simple {
Subroutine simple: called CC=5 SCAR=17.0
Pod undocumented
38 37 (my MY $err) = @_;
39 37 ▶ $err->{cf_error} || do {
Branch: 1 branch
BranchTrueFalseTotal
$err->{"cf_error"} or do { my $msg = ""; $msg .= sprintf($err->{"cf_error_fmt"}, map({defined $_ ? $_ : "(null)";} map({$_ ? @$_ : ();} $err->{"cf_error_param"}))) if $err->{"cf_error_fmt"}; $msg } 0 37 37
40 37 my $msg = '';
41 $msg .= sprintf($err->{cf_error_fmt}
42 28 ▶ , map {defined $_ ? $_ : "(null)"}
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 28 0 28
43 37 ▶ map {$_ ? @$_ : ()} $err->{cf_error_param})
Branch: 1 branch
BranchTrueFalseTotal
$_ ? : 37 0 37
44 37 ▶ if $err->{cf_error_fmt};
Branch: 1 branch
BranchTrueFalseTotal
if $err->{"cf_error_fmt"} 37 0 37
45 37 $msg
46 };
47 }
48  
49 37 ▶sub string {
Subroutine string: called CC=2 SCAR=7.1
Pod undocumented
50 37 (my MY $err) = @_;
51 37 ▶ $err->{cf_error} || do {
Branch: 1 branch
BranchTrueFalseTotal
$err->{"cf_error"} or do { $err->simple . ' ' . $err->error_place . "\n" } 0 37 37
52 37 $err->simple . " " . $err->error_place . "\n";
53 };
54 }
55  
56 0 ▶sub error_node {
Subroutine error_node: not called CC=3 SCAR=24.8
Pod undocumented
57 0 (my MY $err) = @_;
58 0 ▶ $err->{cf_node} || do {
Branch: 1 branch
BranchTrueFalseTotal
$err->{"cf_node"} or do { $err->{"cf_node_obj"} ? stringify_node($err->{"cf_node_obj"}) : "" } 0 0 0
59 0 ▶ $err->{cf_node_obj} ? stringify_node($err->{cf_node_obj}) : ""
Branch: 1 branch
BranchTrueFalseTotal
$err->{'cf_node_obj'} ? : 0 0 0
60 };
61 }
62  
63 37 ▶sub error_place {
Subroutine error_place: called CC=4 SCAR=14.0
Pod undocumented
64 37 (my MY $err) = @_;
65 37 my $place = '';
66 37 ▶ $place .= "($err->{cf_node}), " if $err->{cf_node};
Branch: 1 branch
BranchTrueFalseTotal
if $err->{"cf_node"} 35 2 37
67 37 ▶ $place .= "at file $err->{cf_file}" if $err->{cf_file};
Branch: 1 branch
BranchTrueFalseTotal
if $err->{"cf_file"} 37 0 37
68 37 ▶ $place .= " line $err->{cf_line}" if $err->{cf_line};
Branch: 1 branch
BranchTrueFalseTotal
if $err->{"cf_line"} 37 0 37
69 37 $place;
70 }
71  
72 0 ▶sub is_normal_end {
Subroutine is_normal_end: not called CC=4 SCAR=30.0
Pod undocumented
73 0 (my MY $err) = @_;
74 ref $err
75 and UNIVERSAL::isa($err, MY)
76 and not $err->{cf_error}
77 0 ▶ and $err->{cf_normal};
Branch: 1 branch
BranchTrueFalseTotal
ref $err and UNIVERSAL::isa($err, "YATT::Exception") and not $err->{"cf_error"} and $err->{"cf_normal"} 0 0 0
Condition0%0/6
ref $err and UNIVERSAL::isa($err, "YATT::Exception") and not $err->{"cf_error"}
!ll&&!rl&&r
000
ref $err and UNIVERSAL::isa($err, "YATT::Exception")
!ll&&!rl&&r
000
MC/DC0%0/3
ref $err and UNIVERSAL::isa($err, "YATT::Exception") and not $err->{"cf_error"}
ref $err UNIVERSAL::isa($err, "YATT::Exception") not $err->{"cf_error"}
Truth table0%0/4
A and B and not(C)
A= ref $errB= UNIVERSAL::isa($err, "YATT::Exception")C= not $err->{"cf_error"}
ABCresult
0XX0
10X0
1100
1111
78 }
79  
80 0 ▶sub can_retry {
Subroutine can_retry: not called CC=7 SCAR=40.3
Pod undocumented
81 0 (my MY $err) = @_;
82 return unless
83 ref $err
84 and UNIVERSAL::isa($err, MY)
85 and not $err->{cf_error}
86 and $err->{cf_retry}
87 0 ▶ and ref $err->{cf_retry} eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $err and UNIVERSAL::isa($err, "YATT::Exception") and not $err->{"cf_error"} and $err->{"cf_retry"} and ref $err->{"cf_retry"} eq "ARRAY" 0 0 0
Condition0%0/12
ref $err and UNIVERSAL::isa($err, "YATT::Exception") and not $err->{"cf_error"} and $err->{"cf_retry"} and ref $err->{"cf_retry"} eq "ARRAY"
!ll&&!rl&&r
000
ref $err and UNIVERSAL::isa($err, "YATT::Exception") and not $err->{"cf_error"} and $err->{"cf_retry"}
!ll&&!rl&&r
000
ref $err and UNIVERSAL::isa($err, "YATT::Exception") and not $err->{"cf_error"}
!ll&&!rl&&r
000
ref $err and UNIVERSAL::isa($err, "YATT::Exception")
!ll&&!rl&&r
000
MC/DC0%0/5
ref $err and UNIVERSAL::isa($err, "YATT::Exception") and not $err->{"cf_error"} and $err->{"cf_retry"} and ref $err->{"cf_retry"} eq "ARRAY"
ref $err UNIVERSAL::isa($err, "YATT::Exception") not $err->{"cf_error"} $err->{"cf_retry"} ref $err->{"cf_retry"} eq "ARRAY"
Truth table0%0/6
A and B and not(C) and D and E
A= ref $errB= UNIVERSAL::isa($err, "YATT::Exception")C= not $err->{"cf_error"}D= $err->{"cf_retry"}E= ref $err->{"cf_retry"} eq "ARRAY"
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
88 0 ▶ wantarray ? @{$err->{cf_retry}} : $err->{cf_retry};
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
89 }
90  
91 7 1;
« blib/lib/YATT/Toplevel/Server.pm ↑ Summary web/cgi-bin/yatt.lib/YATT/Util/Enum.pm »