Pure/Print.pm

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