line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Validator::LIVR::Rules::Common; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
15
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
109
|
|
4
|
4
|
|
|
4
|
|
15
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
572
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.08'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub required { |
9
|
|
|
|
|
|
|
return sub { |
10
|
89
|
100
|
100
|
89
|
|
364
|
defined $_[0] && $_[0] ne '' ? undef : 'REQUIRED'; |
11
|
|
|
|
|
|
|
} |
12
|
67
|
|
|
67
|
0
|
424
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub not_empty { |
15
|
|
|
|
|
|
|
return sub { |
16
|
6
|
100
|
100
|
6
|
|
25
|
! defined $_[0] || $_[0] ne '' ? undef : "CANNOT_BE_EMPTY" |
17
|
6
|
|
|
6
|
0
|
40
|
}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub not_empty_list { |
21
|
|
|
|
|
|
|
sub { |
22
|
8
|
|
|
8
|
|
9
|
my $list = shift; |
23
|
8
|
100
|
100
|
|
|
34
|
return 'CANNOT_BE_EMPTY' if !defined($list) || $list eq ''; |
24
|
6
|
100
|
|
|
|
21
|
return 'WRONG_FORMAT' if ref($list) ne 'ARRAY'; |
25
|
5
|
100
|
|
|
|
13
|
return 'CANNOT_BE_EMPTY' unless scalar @$list; |
26
|
3
|
|
|
|
|
24
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
8
|
|
|
8
|
0
|
59
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |