Pure/Die.pm

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