line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perinci::Result::Util; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
650
|
use 5.010001; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
258
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
10
|
|
|
|
|
|
|
is_env_res |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.02'; # VERSION |
14
|
|
|
|
|
|
|
our $DATE = '2014-08-16'; # DATE |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub is_env_res { |
17
|
18
|
|
|
18
|
1
|
5242
|
my $res = shift; |
18
|
|
|
|
|
|
|
|
19
|
18
|
100
|
|
|
|
140
|
return 0 unless ref($res) eq 'ARRAY'; |
20
|
16
|
100
|
|
|
|
46
|
return 0 unless @$res <= 4; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# check status |
23
|
15
|
100
|
100
|
|
|
285
|
return 0 unless defined($res->[0]) && $res->[0] =~ /\A[0-9]{1,3}\z/ |
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
24
|
|
|
|
|
|
|
&& $res->[0] >= 100 && $res->[0] < 599; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# check message |
27
|
8
|
100
|
|
|
|
27
|
return 0 unless !ref($res->[1]); |
28
|
7
|
100
|
|
|
|
19
|
if (defined $res->[1]) { |
29
|
6
|
100
|
|
|
|
135
|
return 0 unless $res->[1] =~ /[A-Za-z]/; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# check result metadata |
33
|
6
|
100
|
100
|
|
|
96
|
return 0 if defined($res->[3]) && ref($res->[3]) ne 'HASH'; |
34
|
|
|
|
|
|
|
|
35
|
5
|
|
|
|
|
157
|
1; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
# ABSTRACT: Utilities related to enveloped result |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |