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