line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Application::Plugin::FormValidator::Simple; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
34474
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @EXPORT); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
66
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
26
|
|
6
|
1
|
|
|
1
|
|
848
|
use FormValidator::Simple; |
|
1
|
|
|
|
|
576506
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
@EXPORT = qw( |
11
|
|
|
|
|
|
|
validator |
12
|
|
|
|
|
|
|
form |
13
|
|
|
|
|
|
|
); |
14
|
1
|
|
|
1
|
|
55
|
sub import { goto &Exporter::import } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$VERSION = '0.03'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub validator { |
19
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
20
|
0
|
|
|
|
|
|
my %params = @_; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $plugins = $params{plugins}; |
23
|
0
|
0
|
|
|
|
|
FormValidator::Simple->import(@$plugins) if $plugins; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $options = $params{options}; |
26
|
0
|
|
|
|
|
|
$self->{validator} = FormValidator::Simple->new(%$options); |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if (exists $params{messages}){ |
29
|
0
|
|
|
|
|
|
FormValidator::Simple->set_messages($params{messages}); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
return $self->{validator}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub form { |
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
38
|
0
|
0
|
|
|
|
|
if ($_[0]) { |
39
|
0
|
0
|
|
|
|
|
my $form = $_[1] ? [@_] : $_[0]; |
40
|
0
|
0
|
|
|
|
|
$self->validator() unless $self->{validator}; |
41
|
0
|
|
|
|
|
|
$self->{form} = $self->{validator}->check($self->query, $form); |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
|
return $self->{form}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
__END__ |