Fatal/Exception.pm

filter: Statementstmt 72.4% 252 / 348 Branchbran 56.6% 94 / 166 Conditioncond 26.4% 18 / 68 MC/DCmcdc 10.0% 5 / 50 Subroutinesub 97.1% 34 / 35 Podpod n/a totaltotal 60.4% 403 / 667 CC 112 SCAR 37.8
CC
112
Cov
63%
__open__Fatal__Exception__Exception__Fatal__import__Test1__wrapped
109.1
__open__Fatal__Exception__Exception__Fatal__import__Test2__wrapped
109.1
__make_fatal
74.5
CRAP 43.6
↑ Summary Exception/Argument.pm »
1 #!/usr/bin/perl -c
2  
3 package Fatal::Exception;
4  
5 =head1 NAME
6  
7 Fatal::Exception - Succeed or throw exception
8  
9 =head1 SYNOPSIS
10  
11 use Fatal::Exception 'Exception::System' => qw< open close >;
12 open my $fh, "/nonexistent"; # throw Exception::System
13  
14 use Exception::Base 'Exception::My';
15 sub juggle { ... }
16 Fatal::Exception->import('Exception::My' => 'juggle');
17 juggle; # succeed or throw exception
18 Fatal::Exception->unimport('juggle');
19 juggle or die; # restore original behavior
20  
21 =head1 DESCRIPTION
22  
23 L<Fatal::Exception> provides a way to conveniently replace functions
24 which normally return a false value when they fail with equivalents
25 which raise exceptions if they are not successful. This is the same as
26 L<Fatal> module from Perl 5.8 and previous but it throws
27 L<Exception::Base> object on error.
28  
29 =cut
30  
31  
32 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 1 our $VERSION = 0.05;
37  
38  
39 1 ▶use Symbol ();
Subroutine BEGIN: called CC=1 SCAR=0.0
40  
41  
42 1 ▶use Exception::Base (
Subroutine BEGIN: called CC=1 SCAR=0.0
43 1 '+ignore_package' => __PACKAGE__,
44 1 );
45 1 ▶use Exception::Argument;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 1 ▶use Exception::Fatal;
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48  
49 # Switch to enable dump for created wrapper functions
50 1 our $Debug;
51  
52  
53 # Cache for not fatalized functions. The key is "$sub".
54 1 our %Not_Fatalized_Functions;
55  
56  
57 # Cache for fatalized functions. The key is "$sub:$exception:$void".
58 1 our %Fatalized_Functions;
59  
60  
61 # Export the wrapped functions to the caller
62 9 ▶sub import {
Subroutine import: called CC=9 SCAR=22.0
63 9 my $pkg = shift;
64 9 ▶ my $exception = shift || return;
Condition100%2/2
shift() || (return)
l!l
72
MC/DC100%1/1
shift() || (return)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
65  
66 7 ▶ Exception::Argument->throw(
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 1 6 7
67 message => 'Not enough arguments for "' . __PACKAGE__ . '->import"',
68 ) unless @_;
69  
70 6 ▶ my $mod_version = $exception->VERSION || 0;
Condition100%2/2
$exception->VERSION || 0
l!l
51
MC/DC100%1/1
$exception->VERSION || 0
$exception->VERSION
Truth table100%2/2
A
A= $exception->VERSION
Aresult
11
00
71 6 ▶ if (not $mod_version) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($mod_version) 1 5 6
72 0 ▶ eval "use $exception;";
Subroutine BEGIN: called CC=1 SCAR=1.2
73 1 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 1 0 1
74 1 Exception::Fatal->throw(
75 message => "Cannot find \"$exception\" exception class",
76 );
77 };
78 };
79  
80 5 my $callpkg = caller;
81 5 my $void = 0;
82  
83 5 foreach my $arg (@_) {
84 21 ▶ if ($arg eq ':void') {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg eq ':void') { } 4 17 21
85 4 $void = 1;
86 }
87 else {
88 17 ▶ my $sub = $arg =~ /::/
Branch: 1 branch
BranchTrueFalseTotal
$arg =~ /::/ ? : 4 13 17
89 ? $arg
90 : $callpkg . '::' . $arg;
91 17 (my $name = $sub) =~ s/^&?(.*::)?//;
92  
93 17 __make_fatal(
94 exception => $exception,
95 name => $name,
96 pkg => $callpkg,
97 sub => $sub,
98 void => $void,
99 );
100 };
101 };
102  
103 4 return 1;
104 };
105  
106  
107 # Restore the non fatalized functions to the caller
108 3 ▶sub unimport {
Subroutine unimport: called CC=4 SCAR=13.9
109 3 my $pkg = shift;
110  
111 3 my $callpkg = caller;
112  
113 3 foreach my $arg (@_) {
114 8 ▶ next if ($arg eq ':void');
Branch: 1 branch
BranchTrueFalseTotal
if $arg eq ":void" 2 6 8
115  
116 6 ▶ my $sub = $arg =~ /::/
Branch: 1 branch
BranchTrueFalseTotal
$arg =~ /::/ ? : 0 6 6
117 ? $arg
118 : $callpkg . '::' . $arg;
119 6 (my $name = $sub) =~ s/^&?(.*::)?//;
120  
121 6 __make_not_fatal(
122 name => $name,
123 pkg => $callpkg,
124 sub => $sub
125 );
126 };
127  
128 3 return 1;
129 };
130  
131  
132 # Create the wrapper. Stolen from Fatal.
133 17 ▶sub __make_fatal {
Subroutine __make_fatal: called CC=21 SCAR=43.1
134 # args:
135 # exception - exception class name
136 # name - base name of sub
137 # pkg - current package name
138 # sub - full name of sub
139 # void - is function called in scalar context?
140 17 my (%args) = @_;
141  
142 # check args
143 Exception::Argument->throw(
144 message => 'Not enough arguments for "' . __PACKAGE__ . '->__make_fatal"',
145 17 ▶ ) if grep { not defined } @args{qw< exception name pkg sub >};
Branch: 1 branch
BranchTrueFalseTotal
if grep {not defined $_;} @args{"exception", "name", "pkg", "sub"} 0 17 17
146  
147 Exception::Argument->throw(
148 message => 'Bad subroutine name for "' . __PACKAGE__ . '": ' . $args{name},
149 17 ▶ ) if not $args{name} =~ /^\w+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"name"} =~ /^\w+$/ 0 17 17
150  
151 17 my ($proto, $code_proto, $call, $core, $argvs);
152 17 ▶ my $cache_key = "$args{sub}:$args{exception}:" . ($args{void} ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$args{'void'} ? : 4 13 17
153 17 ▶ if (defined $Fatalized_Functions{$cache_key} and defined $Not_Fatalized_Functions{$args{sub}}) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $Fatal::Exception::Fatalized_Functions{$cache_key} and defined $Fatal::Exception::Not_Fatalized_Functions{$args{'sub'}}) { } 8 9 17
elsif (defined &{$args{'sub'};} and not eval { do { prototype "CORE::$args{'name'}" } }) { } 4 5 9
Condition66%2/3
defined $Fatal::Exception::Fatalized_Functions{$cache_key} and defined $Fatal::Exception::Not_Fatalized_Functions{$args{"sub"}}
!ll&&!rl&&r
908
MC/DC50%1/2
defined $Fatal::Exception::Fatalized_Functions{$cache_key} and defined $Fatal::Exception::Not_Fatalized_Functions{$args{"sub"}}
defined $Fatal::Exception::Fatalized_Functions{$cache_key} defined $Fatal::Exception::Not_Fatalized_Functions{$args{"sub"}}
Truth table66%2/3
A and B
A= defined $Fatal::Exception::Fatalized_Functions{$cache_key}B= defined $Fatal::Exception::Not_Fatalized_Functions{$args{"sub"}}
ABresult
0X0
100
111
154 # already wrapped: restore from cache
155 8 undef *{ Symbol::qualify_to_ref($args{sub}) };
156 8 return *{ Symbol::qualify_to_ref($args{sub}) } = $Fatalized_Functions{$cache_key};
157 }
158 9 ▶ elsif (defined(&{$args{sub}}) and not eval { prototype "CORE::$args{name}" }) {
Condition100%3/3
defined &{$args{"sub"};} and not eval { do { prototype qq[CORE::$args{"name"}] } }
!ll&&!rl&&r
324
MC/DC100%2/2
defined &{$args{"sub"};} and not eval { do { prototype qq[CORE::$args{"name"}] } }
defined &{$args{"sub"};} not eval { do { prototype qq[CORE::$args{"name"}] } }
Truth table100%3/3
A and not(B)
A= defined &{$args{"sub"};}B= not eval { do { prototype qq[CORE::$args{"name"}] } }
ABresult
0X0
100
111
159 # user subroutine
160 4 $call = "&{\$" . __PACKAGE__ . "::Not_Fatalized_Functions{\"$args{sub}\"}}";
161 4 $proto = prototype $args{sub};
162 2 $Not_Fatalized_Functions{$args{sub}} = \&{$args{sub}}
163 4 ▶ unless defined $Not_Fatalized_Functions{$args{sub}};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $Fatal::Exception::Not_Fatalized_Functions{$args{"sub"}} 2 2 4
164 }
165 else {
166 # CORE subroutine
167 5 $core = 1;
168 5 $call = "CORE::$args{name}";
169 5 $proto = eval { prototype $call };
170  
171 # not found as CORE subroutine
172 5 ▶ Exception::Argument->throw(
Branch: 1 branch
BranchTrueFalseTotal
unless $proto 1 4 5
173 message => "\"$args{sub}\" is not a Perl subroutine",
174 ) unless $proto;
175  
176 # create package's function
177 4 ▶ if (not defined &{$args{sub}}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined &{$args{"sub"};}) 2 2 4
178 # not package's function yet
179 2 $argvs = __fill_argvs($proto);
180 2 my $name = "__$args{name}__Fatal__Exception__not_wrapped";
181 2 my $code = "package $args{pkg};\n"
182 . "sub $name ($proto) {\n"
183 . " no strict 'refs';\n"
184 . __write_invocation(
185 %args,
186 argvs => $argvs,
187 call => $call,
188 orig => 1,
189 )
190 . "}\n";
191 2 ▶ print STDERR $code if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $Fatal::Exception::Debug 0 2 2
192  
193 0 ▶ eval $code;
Subroutine BEGIN: called CC=1 SCAR=0.5
Subroutine BEGIN: called CC=1 SCAR=0.5
Subroutine __open__Fatal__Exception__not_wrapped: called CC=4 SCAR=15.7
Subroutine __opendir__Fatal__Exception__not_wrapped: not called CC=1 SCAR=0.5
Branch: 3 branches
BranchTrueFalseTotal
if (@_ == 1) { } 0 2 2
elsif (@_ == 2) { } 0 2 2
elsif (@_ == 3) { } 2 0 2
194 2 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 2 2
195 0 Exception::Fatal->throw(
196 message => "Cannot create \"$args{sub}\" subroutine",
197 );
198 };
199  
200 2 my $sub = "$args{pkg}::$name";
201 2 ▶ print STDERR "*{ $args{sub} } = \\&$sub;\n" if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $Fatal::Exception::Debug 0 2 2
202 2 undef *{ Symbol::qualify_to_ref($args{sub}) };
203 2 *{ Symbol::qualify_to_ref($args{sub}) } = \&$sub;
204 };
205  
206 4 ▶ if (not defined $Not_Fatalized_Functions{$args{sub}}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $Fatal::Exception::Not_Fatalized_Functions{$args{"sub"}}) 2 2 4
207 2 $Not_Fatalized_Functions{$args{sub}} = \&{$args{sub}};
208 };
209 };
210  
211 8 ▶ if (defined $proto) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $proto) { } 4 4 8
212 4 $code_proto = " ($proto)";
213 }
214 else {
215 4 $code_proto = '';
216 4 $proto = '@';
217 };
218  
219 8 ▶ $argvs = __fill_argvs($proto) if not defined $argvs;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $argvs 6 2 8
220  
221 # define new named subroutine (anonymous would be harder to debug from stacktrace)
222 8 ▶ my $name = "__$args{name}__Fatal__Exception__$args{exception}" . ($args{void} ? '_void' : '') . "__wrapped";
Branch: 1 branch
BranchTrueFalseTotal
$args{'void'} ? : 2 6 8
223 8 $name =~ tr/:/_/;
224  
225 8 my $code = "package $args{pkg};\n"
226 . "sub $name$code_proto {\n"
227 . " no strict 'refs';\n"
228 . __write_invocation(
229 %args,
230 argvs => $argvs,
231 call => $call,
232 )
233 . "}\n";
234 8 ▶ print STDERR $code if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $Fatal::Exception::Debug 0 8 8
235  
236 0 ▶ my $newsub = eval $code;
Subroutine BEGIN: called CC=1 SCAR=2.2
Subroutine BEGIN: called CC=1 SCAR=2.2
Subroutine BEGIN: called CC=1 SCAR=2.2
Subroutine BEGIN: called CC=1 SCAR=2.2
Subroutine BEGIN: called CC=1 SCAR=2.2
Subroutine BEGIN: called CC=1 SCAR=2.2
Subroutine BEGIN: called CC=1 SCAR=2.2
Subroutine BEGIN: called CC=1 SCAR=2.2
Subroutine __open__Fatal__Exception__Exception__Fatal__import__Test1__wrapped: called CC=19 SCAR=46.9
Subroutine __open__Fatal__Exception__Exception__Fatal__import__Test2__wrapped: called CC=19 SCAR=46.9
Subroutine __opendir__Fatal__Exception__Exception__Fatal__import__Test1_void__wrapped: called CC=4 SCAR=20.8
Subroutine __opendir__Fatal__Exception__Exception__Fatal__import__Test2_void__wrapped: called CC=4 SCAR=20.8
Subroutine __sub_test1__Fatal__Exception__Exception__Fatal__import__Test1__wrapped: called CC=6 SCAR=27.1
Subroutine __sub_test1__Fatal__Exception__Exception__Fatal__import__Test2__wrapped: called CC=6 SCAR=27.1
Subroutine __sub_test2__Fatal__Exception__Exception__Fatal__import__Test1__wrapped: called CC=6 SCAR=27.1
Subroutine __sub_test2__Fatal__Exception__Exception__Fatal__import__Test2__wrapped: called CC=6 SCAR=27.1
Branch: 40 branches
BranchTrueFalseTotal
if (@_ == 1) { } 0 4 4
elsif (@_ == 2) { } 0 4 4
elsif (@_ == 3) { } 3 1 4
defined wantarray ? : 0 0 0
if ($@) 0 0 0
if ($@) 0 0 0
defined wantarray ? : 0 0 0
if ($@) 0 0 0
if ($@) 0 0 0
defined wantarray ? : 0 3 3
if ($@) 0 0 0
if ($@) 1 2 3
if (@_ == 1) { } 0 3 3
elsif (@_ == 2) { } 0 3 3
elsif (@_ == 3) { } 3 0 3
defined wantarray ? : 0 0 0
if ($@) 0 0 0
if ($@) 0 0 0
defined wantarray ? : 0 0 0
if ($@) 0 0 0
if ($@) 0 0 0
defined wantarray ? : 0 3 3
if ($@) 0 0 0
if ($@) 0 3 3
defined wantarray ? : 2 2 4
if ($@) 1 1 2
defined wantarray ? : 3 5 8
if ($@) 0 5 5
defined wantarray ? : 0 1 1
if ($@) 0 0 0
if ($@) 0 1 1
defined wantarray ? : 0 3 3
if ($@) 0 0 0
if ($@) 0 3 3
defined wantarray ? : 0 1 1
if ($@) 0 0 0
if ($@) 0 1 1
defined wantarray ? : 0 5 5
if ($@) 0 0 0
if ($@) 0 5 5
Condition15%9/58
do { my(@return) = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
l!l&&r!l&&!r
000
do { my $return = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
l!l&&r!l&&!r
000
do { my(@return) = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
l!l&&r!l&&!r
000
do { my $return = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
l!l&&r!l&&!r
000
do { my(@return) = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
l!l&&r!l&&!r
000
do { my $return = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
l!l
11
do { my(@return) = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
l!l&&r!l&&!r
000
do { my $return = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
l!l&&r!l&&!r
000
do { my(@return) = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
l!l&&r!l&&!r
000
do { my $return = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
l!l&&r!l&&!r
000
do { my(@return) = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
l!l&&r!l&&!r
000
do { my $return = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
l!l
03
do { my $return = eval { do { CORE::opendir $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot opendir"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot opendir")
l!l
01
do { my $return = eval { do { CORE::opendir $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot opendir"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot opendir")
l!l
05
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; @return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test1")
l!l&&r!l&&!r
000
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test1")
l!l
01
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; @return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test1")
l!l&&r!l&&!r
000
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test1")
l!l
03
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; @return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test2")
l!l&&r!l&&!r
000
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test2")
l!l
01
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; @return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test2")
l!l&&r!l&&!r
000
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test2")
l!l
05
MC/DC0%0/2
do { my(@return) = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
do { my(@return) = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my $return = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
do { my $return = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my(@return) = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
do { my(@return) = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my $return = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
do { my $return = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my(@return) = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
do { my(@return) = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my $return = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
do { my $return = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my(@return) = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
do { my(@return) = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my $return = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
do { my $return = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my(@return) = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
do { my(@return) = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my $return = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
do { my $return = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my(@return) = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
do { my(@return) = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my $return = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
do { my $return = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
MC/DC0%0/2
do { my $return = eval { do { CORE::opendir $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot opendir"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot opendir")
do { my $return = eval { do { CORE::opendir $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot opendir"); } ; $return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot opendir")
MC/DC0%0/2
do { my $return = eval { do { CORE::opendir $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot opendir"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot opendir")
do { my $return = eval { do { CORE::opendir $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot opendir"); } ; $return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot opendir")
MC/DC0%0/2
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; @return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test1")
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; @return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test1")
MC/DC0%0/2
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test1")
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; $return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test1")
MC/DC0%0/2
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; @return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test1")
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; @return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test1")
MC/DC0%0/2
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test1")
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; $return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test1")
MC/DC0%0/2
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; @return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test2")
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; @return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test2")
MC/DC0%0/2
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; $return } or "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test2")
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; $return } "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test2")
MC/DC0%0/2
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; @return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test2")
do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; @return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test2")
MC/DC0%0/2
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; $return } or "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test2")
do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; $return } "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test2")
Truth table0%0/3
A or B
A= do { my(@return) = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my $return = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my(@return) = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my $return = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my(@return) = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table66%2/3
A or B
A= do { my $return = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my(@return) = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my $return = eval { do { CORE::open $_[0] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my(@return) = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my $return = eval { do { CORE::open $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my(@return) = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; @return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= do { my $return = eval { do { CORE::open $_[0], $_[1], @_[2 .. $#_] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot open"); } ; $return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot open")
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= do { my $return = eval { do { CORE::opendir $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot opendir"); } ; $return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot opendir")
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= do { my $return = eval { do { CORE::opendir $_[0], $_[1] } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot opendir"); } ; $return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot opendir")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; @return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test1")
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; $return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test1")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; @return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test1")
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::sub_test1"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test1"); } ; $return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test1")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; @return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test2")
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; $return }B= "Exception::Fatal::import::Test1"->throw("ignore_level", 1, "message", "Cannot sub_test2")
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= do { my(@return) = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; @return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test2")
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= do { my $return = eval { do { &{$Fatal::Exception::Not_Fatalized_Functions{"Fatal::ExceptionTest::Package1::sub_test2"};}(@_[0 .. $#_]) } }; if ($@) { "Exception::Fatal"->throw("ignore_level", 1, "message", "Cannot sub_test2"); } ; $return }B= "Exception::Fatal::import::Test2"->throw("ignore_level", 1, "message", "Cannot sub_test2")
ABresult
1X1
011
000
237 8 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 8 8
238 0 Exception::Fatal->throw(
239 message => "Cannot create \"$args{sub}\" subroutine",
240 );
241 };
242  
243 8 my $sub = "$args{pkg}::$name";
244 8 ▶ print STDERR "*{ $args{sub} } = \\&$sub;\n" if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $Fatal::Exception::Debug 0 8 8
245  
246 8 undef *{ Symbol::qualify_to_ref($args{sub}) };
247 8 return *{ Symbol::qualify_to_ref($args{sub}) } = $Fatalized_Functions{$cache_key} = \&$sub;
248 };
249  
250  
251 # Restore the not-fatalized function.
252 6 ▶sub __make_not_fatal {
Subroutine __make_not_fatal: called CC=4 SCAR=14.0
253 # args:
254 # name - base name of sub
255 # pkg - current package name
256 # sub - full name of sub
257 6 my (%args) = @_;
258  
259 # check args
260 Exception::Argument->throw(
261 message => 'Not enough arguments for "' . __PACKAGE__ . '->__make_non_fatal"',
262 6 ▶ ) if grep { not defined } @args{qw< name pkg sub >};
Branch: 1 branch
BranchTrueFalseTotal
if grep {not defined $_;} @args{"name", "pkg", "sub"} 0 6 6
263  
264 Exception::Argument->throw(
265 message => 'Bad subroutine name for "' . __PACKAGE__ . '": ' . $args{name},
266 6 ▶ ) if not $args{name} =~ /^\w+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"name"} =~ /^\w+$/ 0 6 6
267  
268 # not wrapped - do nothing
269 6 ▶ return unless defined $Not_Fatalized_Functions{$args{sub}};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $Fatal::Exception::Not_Fatalized_Functions{$args{"sub"}} 2 4 6
270  
271 4 undef *{ Symbol::qualify_to_ref($args{sub}) };
272 4 return *{ Symbol::qualify_to_ref($args{sub}) } = $Not_Fatalized_Functions{$args{sub}};
273 };
274  
275  
276 # Fill argvs array based on function prototype. Stolen from Fatal.
277 8 ▶sub __fill_argvs {
Subroutine __fill_argvs: called CC=7 SCAR=19.7
278 8 my $proto = shift;
279  
280 8 my $n = -1;
281 8 my (@code, @protos, $seen_semi);
282  
283 8 ▶ while ($proto =~ /\S/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proto =~ /\S/) 16 2 18
284 16 $n++;
285 16 ▶ if ($seen_semi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seen_semi) 4 12 16
286 4 push(@protos,[$n,@code]);
287 };
288 16 ▶ if ($proto =~ s/^\s*\\([\@%\$\&])//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proto =~ s/^\s*\\([\@%\$\&])//) 0 16 16
289 0 push(@code, $1 . "{\$_[$n]}");
290 0 next;
291 };
292 16 ▶ if ($proto =~ s/^\s*([*\$&])//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proto =~ s/^\s*([*\$&])//) 8 8 16
293 8 push(@code, "\$_[$n]");
294 8 next;
295 };
296 8 ▶ if ($proto =~ s/^\s*(;\s*)?\@//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proto =~ s/^\s*(;\s*)?\@//) 6 2 8
297 6 push(@code, "\@_[$n..\$#_]");
298 6 last;
299 };
300 2 ▶ if ($proto =~ s/^\s*;//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proto =~ s/^\s*;//) 2 0 2
301 2 $seen_semi = 1;
302 2 $n--;
303 2 next;
304 };
305 0 Exception::Argument->throw(
306 message => "Unknown prototype letters: \"$proto\"",
307 );
308 };
309 8 push @protos, [$n+1, @code];
310 8 return \@protos;
311 };
312  
313  
314 # Write subroutine invocation. Stolen from Fatal.
315 10 ▶sub __write_invocation {
Subroutine __write_invocation: called CC=4 SCAR=13.9
316 # args:
317 # argvs - ref to prototypes stored as array of array of calling arguments
318 # call - called sub full name
319 # exception - exception class name
320 # name - base name of sub
321 # orig - is function called as non-fatalized version?
322 # void - is function called in scalar context?
323 10 my (%args) = @_;
324  
325 # check args
326 Exception::Argument->throw(
327 message => 'Not enough arguments for "' . __PACKAGE__ . '->__write_invocation"',
328 10 ▶ ) if grep { not defined } @args{qw< argvs call exception name >};
Branch: 1 branch
BranchTrueFalseTotal
if grep {not defined $_;} @args{"argvs", "call", "exception", "name"} 0 10 10
329  
330 10 my @argvs = @{ $args{argvs} };
331  
332 10 my $code;
333  
334 10 ▶ if (@argvs == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@argvs == 1) { } 7 3 10
335 # No optional arguments
336 7 my @argv = @{ $argvs[0] };
337 7 shift @argv;
338 7 $code =
339 " "
340 . __one_invocation(
341 %args,
342 argv => \@argv,
343 )
344 . ";\n";
345 }
346 else {
347 3 my $else = " ";
348 3 my (@out, @argv, $n);
349 3 ▶ while (@argvs) {
Branch: 1 branch
BranchTrueFalseTotal
if (@argvs) 9 3 12
350 9 @argv = @{shift @argvs};
351 9 $n = shift @argv;
352 9 push @out, "${else}if (\@_ == $n) {\n";
353 9 $else = " }\n els";
354 9 push @out,
355 " return "
356 . __one_invocation(
357 %args,
358 argv => \@argv,
359 )
360 . ";\n";
361 }
362 3 push @out,
363 " };\n"
364 . " Exception::Argument->throw(\n"
365 . " ignore_level => 1,\n"
366 . " message => \"$args{name}: Do not expect to get \" . scalar \@_ . \" arguments\"\n"
367 . " );\n";
368 3 $code = join '', @out;
369 };
370  
371 10 return $code;
372 };
373  
374  
375 # Write subroutine invocation. Stolen from Fatal.
376 16 ▶sub __one_invocation {
Subroutine __one_invocation: called CC=4 SCAR=13.9
377 # args:
378 # argv - ref to prototypes stored as array of calling arguments
379 # call - called sub full name
380 # exception - exception class name
381 # name - base name of sub
382 # orig - is function called as non-fatalized version?
383 # void - is function called in scalar context?
384 16 my (%args) = @_;
385  
386 # check args
387 Exception::Argument->throw(
388 message => 'Not enough arguments for "' . __PACKAGE__ . '->__one_invocation"',
389 16 ▶ ) if grep { not defined } @args{qw< argv call exception name >};
Branch: 1 branch
BranchTrueFalseTotal
if grep {not defined $_;} @args{"argv", "call", "exception", "name"} 0 16 16
390  
391 16 my $argv = join ', ', @{$args{argv}};
392  
393 16 my $code;
394  
395 16 ▶ if ($args{orig}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($args{'orig'}) { } 4 12 16
elsif ($args{'void'}) { } 2 10 12
396 4 return "$args{call}($argv)";
397 }
398 elsif ($args{void}) {
399 2 $code = "(defined wantarray)\n"
400 . " ? $args{call}($argv)\n"
401 . " : do {\n"
402 . " my \$return = eval {\n"
403 . " $args{call}($argv);\n"
404 . " };\n"
405 . " if (\$@) {\n"
406 . " Exception::Fatal->throw(\n"
407 . " ignore_level => 1,\n"
408 . " message => \"Cannot $args{name}\",\n"
409 . " );\n"
410 . " };\n"
411 . " \$return;\n"
412 . " } || $args{exception}->throw(\n"
413 . " ignore_level => 1,\n"
414 . " message => \"Cannot $args{name}\",\n"
415 . " )";
416 }
417 else {
418 10 $code = "$args{call}($argv)\n"
419 . " || $args{exception}->throw(\n"
420 . " ignore_level => 1,\n"
421 . " message => \"Cannot $args{name}\"\n"
422 . " )";
423 10 $code = "(defined wantarray)\n"
424 . " ? do {\n"
425 . " my \@return = eval {\n"
426 . " $args{call}($argv);\n"
427 . " };\n"
428 . " if (\$@) {\n"
429 . " Exception::Fatal->throw(\n"
430 . " ignore_level => 1,\n"
431 . " message => \"Cannot $args{name}\",\n"
432 . " );\n"
433 . " };\n"
434 . " \@return;\n"
435 . " } || $args{exception}->throw(\n"
436 . " ignore_level => 1,\n"
437 . " message => \"Cannot $args{name}\",\n"
438 . " )\n"
439 . " : do {\n"
440 . " my \$return = eval {\n"
441 . " $args{call}($argv);\n"
442 . " };\n"
443 . " if (\$@) {\n"
444 . " Exception::Fatal->throw(\n"
445 . " ignore_level => 1,\n"
446 . " message => \"Cannot $args{name}\",\n"
447 . " );\n"
448 . " };\n"
449 . " \$return;\n"
450 . " } || $args{exception}->throw(\n"
451 . " ignore_level => 1,\n"
452 . " message => \"Cannot $args{name}\",\n"
453 . " )";
454 };
455  
456 12 return $code;
457 };
458  
459  
460 1 1;
461  
462  
463 __END__
↑ Summary Exception/Argument.pm »