blib/lib/Perinci/Result/Util.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 14 / 14 Conditioncond 100% 12 / 12 MC/DCmcdc 100% 6 / 6 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 60 / 60 CC 12 SCAR 22.8
CC
12
Cov
100%
is_env_res
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 9.8
↑ Summary
1 package Perinci::Result::Util;
2  
3 2 ▶use 5.010001;
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 require Exporter;
8 2 our @ISA = qw(Exporter);
9 2 our @EXPORT_OK = qw(
10 is_env_res
11 );
12  
13 2 our $VERSION = '0.03'; # VERSION
14 2 our $DATE = '2015-09-03'; # DATE
15  
16 18 ▶sub is_env_res {
Subroutine is_env_res: called CC=12 SCAR=24.8
Pod documented
17 18 my $res = shift;
18  
19 18 ▶ return 0 unless ref($res) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $res eq "ARRAY" 2 16 18
20 16 ▶ return 0 unless @$res <= 4;
Branch: 1 branch
BranchTrueFalseTotal
unless @$res <= 4 1 15 16
21  
22 # check status
23 15 ▶ return 0 unless defined($res->[0]) && $res->[0] =~ /\A[0-9]{1,3}\z/
Branch: 1 branch
BranchTrueFalseTotal
unless defined $res->[0] and $res->[0] =~ /\A[0-9]{1,3}\z/ and $res->[0] >= 100 and $res->[0] < 599 7 8 15
Condition100%9/9
defined $res->[0] and $res->[0] =~ /\A[0-9]{1,3}\z/ and $res->[0] >= 100 and $res->[0] < 599
!ll&&!rl&&r
618
defined $res->[0] and $res->[0] =~ /\A[0-9]{1,3}\z/ and $res->[0] >= 100
!ll&&!rl&&r
519
defined $res->[0] and $res->[0] =~ /\A[0-9]{1,3}\z/
!ll&&!rl&&r
1410
MC/DC100%4/4
defined $res->[0] and $res->[0] =~ /\A[0-9]{1,3}\z/ and $res->[0] >= 100 and $res->[0] < 599
defined $res->[0] $res->[0] =~ /\A[0-9]{1,3}\z/ $res->[0] >= 100 $res->[0] < 599
Truth table100%5/5
A and B and C and D
A= defined $res->[0]B= $res->[0] =~ /\A[0-9]{1,3}\z/C= $res->[0] >= 100D= $res->[0] < 599
ABCDresult
0XXX0
10XX0
110X0
11100
11111
24 && $res->[0] >= 100 && $res->[0] < 599;
25  
26 # check message
27 8 ▶ return 0 unless !ref($res->[1]);
Branch: 1 branch
BranchTrueFalseTotal
if ref $res->[1] 1 7 8
28 7 ▶ if (defined $res->[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $res->[1]) 6 1 7
29 6 ▶ return 0 unless $res->[1] =~ /[A-Za-z]/;
Branch: 1 branch
BranchTrueFalseTotal
unless $res->[1] =~ /[A-Za-z]/ 1 5 6
30 }
31  
32 # check result metadata
33 6 ▶ return 0 if defined($res->[3]) && ref($res->[3]) ne 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if defined $res->[3] and ref $res->[3] ne "HASH" 1 5 6
Condition100%3/3
defined $res->[3] and ref $res->[3] ne "HASH"
!ll&&!rl&&r
411
MC/DC100%2/2
defined $res->[3] and ref $res->[3] ne "HASH"
defined $res->[3] ref $res->[3] ne "HASH"
Truth table100%3/3
A and B
A= defined $res->[3]B= ref $res->[3] ne "HASH"
ABresult
0X0
100
111
34  
35 5 1;
36 }
37  
38 2 1;
39 # ABSTRACT: Utilities related to enveloped result
40  
41 __END__
↑ Summary