Pure/ErrorList.pm

filter: Statementstmt 97.1% 34 / 35 Branchbran 100% 4 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 94.4% 51 / 54 SCAR 13.9
CC
4
Cov
95%
err
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 4.0
« Pure/Die.pm ↑ Summary Pure/Print.pm »
1 package Error::Pure::ErrorList;
2  
3 5 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 ▶use Error::Pure::Utils qw(err_helper);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use Error::Pure::Output::Text qw(err_line_all);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use List::Util qw(none);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # Constants.
13 5 Readonly::Array our @EXPORT_OK => qw(err);
14 5 Readonly::Scalar my $EVAL => 'eval {...}';
15  
16 5 our $VERSION = 0.30;
17  
18 # Process error.
19 sub err {
20 7 ▶ my @msg = @_;
Subroutine err: called CC=3 SCAR=11.0
Pod documented
21  
22 # Get errors structure.
23 7 my @errors = err_helper(@msg);
24  
25 # Finalize in main on last err.
26 7 my $stack_ar = $errors[-1]->{'stack'};
27 7 ▶ 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;}))) { } 2 5 7
Condition66%2/3
$stack_ar->[-1]{"class"} eq "main" and &none(sub { $_ eq $EVAL or $_ =~ /^eval '/ms; } , map({$_->{"sub"};} @{$stack_ar;}))
!ll&&!rl&&r
052
MC/DC50%1/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 table66%2/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 12 ▶ && none { $_ eq $EVAL || $_ =~ /^eval '/ms }
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$_ eq $EVAL or $_ =~ /^eval '/ms 7 5 12
29 12 map { $_->{'sub'} } @{$stack_ar}) {
30  
31 2 die err_line_all(@errors);
32  
33 # Die for eval.
34 } else {
35 5 die "$errors[-1]->{'msg'}->[0]\n";
36 }
37  
38 0 return;
39 }
40  
41 5 1;
42  
43 __END__
« Pure/Die.pm ↑ Summary Pure/Print.pm »