| 1 | package Error::Pure::ANSIColor::ErrorList; | ||||||||||||||||||||||||||||
| 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::Utils qw(err_helper); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Error::Pure::Output::ANSIColor qw(err_line_all); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use List::Util qw(none); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Readonly; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # Constants. | ||||||||||||||||||||||||||||
| 13 | 2 | Readonly::Array our @EXPORT_OK => qw(err); | |||||||||||||||||||||||||||
| 14 | 2 | Readonly::Scalar my $EVAL => 'eval {...}'; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | our $VERSION = 0.28; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | # Process error. | ||||||||||||||||||||||||||||
| 19 | sub err { | ||||||||||||||||||||||||||||
| 20 | 0 | ▶ | my @msg = @_; | ||||||||||||||||||||||||||
|
Subroutine
err: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | # Get errors structure. | ||||||||||||||||||||||||||||
| 23 | 0 | my @errors = err_helper(@msg); | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | # Finalize in main on last err. | ||||||||||||||||||||||||||||
| 26 | 0 | my $stack_ar = $errors[-1]->{'stack'}; | |||||||||||||||||||||||||||
| 27 | 0 | ▶ | if ($stack_ar->[-1]->{'class'} eq 'main' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$stack_ar->[-1]{"class"} eq "main" and &none(sub {
$_ eq $EVAL or $_ =~ /^eval '/ms;
}
, map({$_->{"sub"};} @{$stack_ar;}))
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;}))
| |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | && none { $_ eq $EVAL || $_ =~ /^eval '/ms } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | map { $_->{'sub'} } @{$stack_ar}) { | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | die err_line_all(@errors); | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # Die for eval. | ||||||||||||||||||||||||||||
| 34 | } else { | ||||||||||||||||||||||||||||
| 35 | 0 | die "$errors[-1]->{'msg'}->[0]\n"; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | return; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 2 | 1; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | __END__ | ||||||||||||||||||||||||||||