Pure/AllError.pm

filter: Statementstmt 94.2% 33 / 35 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 87.0% 47 / 54 SCAR 13.9
CC
4
Cov
88%
err
3.2
__ANON__
2.0
BEGIN
1.0
CRAP 4.0
« Pure.pm ↑ Summary Pure/Error.pm »
1 package Error::Pure::AllError;
2  
3 3 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Error::Pure::Utils qw(err_helper);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Error::Pure::Output::Text qw(err_bt_pretty);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use List::Util qw(none);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # Constants.
13 3 Readonly::Array our @EXPORT_OK => qw(err);
14 3 Readonly::Scalar my $EVAL => 'eval {...}';
15  
16 3 our $VERSION = 0.31;
17  
18 # Process error.
19 sub err {
20 5 ▶ my @msg = @_;
Subroutine err: called CC=3 SCAR=11.7
Pod documented
21  
22 # Get errors structure.
23 5 my @errors = err_helper(@msg);
24  
25 # Finalize in main on last err.
26 5 my $stack_ar = $errors[-1]->{'stack'};
27 5 ▶ if ($stack_ar->[-1]->{'class'} eq 'main'
Branch: 1 branch
BranchTrueFalseTotal
if ($stack_ar->[-1]{'class'} eq 'main' and &none(sub { $_ eq $EVAL or $_ =~ /^eval '/ms; } , map({$_->{'sub'};} @{$stack_ar;}))) { } 0 5 5
Condition33%1/3
$stack_ar->[-1]{"class"} eq "main" and &none(sub { $_ eq $EVAL or $_ =~ /^eval '/ms; } , map({$_->{"sub"};} @{$stack_ar;}))
!ll&&!rl&&r
050
MC/DC0%0/2
$stack_ar->[-1]{"class"} eq "main" and &none(sub { $_ eq $EVAL or $_ =~ /^eval '/ms; } , map({$_->{"sub"};} @{$stack_ar;}))
$stack_ar->[-1]{"class"} eq "main" &none(sub { $_ eq $EVAL or $_ =~ /^eval '/ms; } , map({$_->{"sub"};} @{$stack_ar;}))
Truth table33%1/3
A and B
A= $stack_ar->[-1]{"class"} eq "main"B= &none(sub { $_ eq $EVAL or $_ =~ /^eval '/ms; } , map({$_->{"sub"};} @{$stack_ar;}))
ABresult
0X0
100
111
28 10 ▶ && none { $_ eq $EVAL || $_ =~ m/^eval '/ms }
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$_ eq $EVAL or $_ =~ /^eval '/ms 5 5 10
29 10 map { $_->{'sub'} } @{$stack_ar}) {
30  
31 0 die scalar err_bt_pretty(@errors);
32  
33 # Die for eval.
34 } else {
35 5 die "$errors[-1]->{'msg'}->[0]\n";
36 }
37  
38 0 return;
39 }
40  
41 3 1;
42  
43 __END__
« Pure.pm ↑ Summary Pure/Error.pm »