line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Validator::LIVR::Rules::Common; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
13
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
91
|
|
4
|
4
|
|
|
4
|
|
12
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
701
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '2.0'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub required { |
9
|
|
|
|
|
|
|
return sub { |
10
|
139
|
100
|
100
|
139
|
|
427
|
defined $_[0] && $_[0] ne '' ? undef : 'REQUIRED'; |
11
|
|
|
|
|
|
|
} |
12
|
137
|
|
|
137
|
0
|
719
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub not_empty { |
15
|
|
|
|
|
|
|
return sub { |
16
|
10
|
100
|
100
|
10
|
|
32
|
! defined $_[0] || $_[0] ne '' ? undef : "CANNOT_BE_EMPTY" |
17
|
10
|
|
|
10
|
0
|
55
|
}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub not_empty_list { |
21
|
|
|
|
|
|
|
return sub { |
22
|
8
|
|
|
8
|
|
7
|
my $list = shift; |
23
|
8
|
100
|
100
|
|
|
32
|
return 'CANNOT_BE_EMPTY' if !defined($list) || $list eq ''; |
24
|
6
|
100
|
|
|
|
14
|
return 'FORMAT_ERROR' if ref($list) ne 'ARRAY'; |
25
|
5
|
100
|
|
|
|
15
|
return 'CANNOT_BE_EMPTY' unless scalar @$list; |
26
|
3
|
|
|
|
|
5
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
8
|
|
|
8
|
0
|
43
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub any_object { |
31
|
|
|
|
|
|
|
return sub { |
32
|
9
|
|
|
9
|
|
11
|
my $value = shift; |
33
|
9
|
100
|
100
|
|
|
31
|
return if !defined($value) || $value eq ''; |
34
|
7
|
100
|
|
|
|
23
|
return 'FORMAT_ERROR' if ref($value) ne 'HASH'; |
35
|
|
|
|
|
|
|
} |
36
|
9
|
|
|
9
|
0
|
51
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |