ANSIColor/Die.pm

filter: Statementstmt 72.2% 26 / 36 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 77.7% 7 / 9 Podpod 100% 1 / 1 totaltotal 61.8% 34 / 55 SCAR 16.1
CC
4
Cov
60%
err
12.0
__ANON__
6.0
BEGIN
1.0
CRAP 5.0
« ANSIColor/ErrorList.pm ↑ Summary ANSIColor/Print.pm »
1 package Error::Pure::ANSIColor::Die;
2  
3 2 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use Error::Pure::Output::ANSIColor qw(err_die);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Error::Pure::Utils qw(err_helper);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use List::MoreUtils qw(none);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 our $VERSION = 0.27;
13  
14 # Constants.
15 2 Readonly::Array our @EXPORT_OK => qw(err);
16 2 Readonly::Scalar my $EVAL => 'eval {...}';
17 2 Readonly::Scalar my $EMPTY_STR => q{};
18  
19 # Process error.
20 sub err {
21 0 ▶ my @msg = @_;
Subroutine err: not called CC=3 SCAR=24.8
Pod documented
22  
23 # Get errors structure.
24 0 my @errors = err_helper(@msg);
25  
26 # Finalize in main on last err.
27 0 my $stack_ar = $errors[-1]->{'stack'};
28 0 ▶ 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 0 0
Condition0%0/3
$stack_ar->[-1]{"class"} eq "main" and &none(sub { $_ eq $EVAL or $_ =~ /^eval '/ms; } , map({$_->{"sub"};} @{$stack_ar;}))
!ll&&!rl&&r
000
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 table0%0/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 0 ▶ && none { $_ eq $EVAL || $_ =~ /^eval '/ms }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_ eq $EVAL or $_ =~ /^eval '/ms 0 0 0
30 0 map { $_->{'sub'} } @{$stack_ar}) {
31  
32 0 die err_die(@errors)."\n";
33  
34 # Die for eval.
35 } else {
36 0 die "$errors[-1]->{'msg'}->[0]\n";
37 }
38  
39 0 return;
40 }
41  
42 2 1;
43  
44 __END__
« ANSIColor/ErrorList.pm ↑ Summary ANSIColor/Print.pm »