Pure/PrintVar.pm

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