| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Nephia::Plugin::FormValidator::Lite; |
|
2
|
2
|
|
|
2
|
|
262229
|
use 5.008005; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
79
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
58
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
11
|
|
|
|
2
|
|
|
|
|
94
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.03"; |
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1940
|
use FormValidator::Lite; |
|
|
2
|
|
|
|
|
94221
|
|
|
|
2
|
|
|
|
|
16
|
|
|
9
|
2
|
|
|
2
|
|
82
|
use Carp qw/croak/; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
118
|
|
|
10
|
2
|
|
|
2
|
|
13
|
use Try::Tiny; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
118
|
|
|
11
|
2
|
|
|
2
|
|
935
|
use parent 'Nephia::Plugin'; |
|
|
2
|
|
|
|
|
298
|
|
|
|
2
|
|
|
|
|
13
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
|
14
|
1
|
|
|
1
|
0
|
22
|
my ($class, %opts) = @_; |
|
15
|
1
|
|
|
|
|
11
|
my $self = $class->SUPER::new(%opts); |
|
16
|
1
|
|
|
|
|
95
|
$self->{RUN_SQL} = []; |
|
17
|
1
|
|
|
|
|
3
|
return $self; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
1
|
37413
|
sub exports { qw/form/ } |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub form(@) { |
|
23
|
6
|
|
|
6
|
0
|
42
|
my $self = shift; |
|
24
|
6
|
|
|
|
|
9
|
my $context = shift; |
|
25
|
|
|
|
|
|
|
sub (@) { |
|
26
|
2
|
|
|
2
|
|
865
|
my %rule = @_; |
|
27
|
2
|
|
|
|
|
8
|
my $req = $context->get('req'); |
|
28
|
2
|
|
|
|
|
13
|
my $conf = $context->get('config')->{'Plugin::FormValidator::Lite'}; |
|
29
|
|
|
|
|
|
|
try { |
|
30
|
2
|
|
|
2
|
|
68
|
FormValidator::Lite->load_constraints(@{$conf->{constants}}); |
|
|
2
|
|
|
|
|
21
|
|
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
catch { |
|
33
|
0
|
|
|
0
|
|
0
|
croak 'Constraints of FormValidator::Lite is invalid format in config'; |
|
34
|
2
|
|
|
|
|
23
|
}; |
|
35
|
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
188162
|
my $validator; |
|
37
|
|
|
|
|
|
|
try { |
|
38
|
2
|
|
|
2
|
|
71
|
$validator = FormValidator::Lite->new($req); |
|
39
|
2
|
|
|
|
|
44
|
$validator->load_function_message($conf->{function_message}); |
|
40
|
2
|
|
|
|
|
2316
|
$validator->check( |
|
41
|
|
|
|
|
|
|
%rule |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# default param message is param key |
|
45
|
6
|
|
|
|
|
21
|
$validator->set_param_message( |
|
46
|
2
|
|
|
|
|
3916
|
map { $_, $_ } keys %rule |
|
47
|
|
|
|
|
|
|
); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
catch { |
|
50
|
0
|
|
|
0
|
|
0
|
die $_; |
|
51
|
2
|
|
|
|
|
17
|
}; |
|
52
|
|
|
|
|
|
|
|
|
53
|
2
|
|
|
|
|
72
|
return $validator; |
|
54
|
6
|
|
|
|
|
109
|
}; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
|
58
|
|
|
|
|
|
|
__END__ |