line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Tiny::Plugin::Base; |
2
|
|
|
|
|
|
|
$Form::Tiny::Plugin::Base::VERSION = '2.20'; |
3
|
43
|
|
|
43
|
|
601
|
use v5.10; |
|
43
|
|
|
|
|
158
|
|
4
|
43
|
|
|
43
|
|
269
|
use strict; |
|
43
|
|
|
|
|
128
|
|
|
43
|
|
|
|
|
1203
|
|
5
|
43
|
|
|
43
|
|
229
|
use warnings; |
|
43
|
|
|
|
|
135
|
|
|
43
|
|
|
|
|
1467
|
|
6
|
|
|
|
|
|
|
|
7
|
43
|
|
|
43
|
|
400
|
use parent 'Form::Tiny::Plugin'; |
|
43
|
|
|
|
|
198
|
|
|
43
|
|
|
|
|
422
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# This plugin is the core of Form::Tiny DSL |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub plugin |
12
|
|
|
|
|
|
|
{ |
13
|
65
|
|
|
65
|
1
|
218
|
my ($self, $caller, $context) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
return { |
16
|
|
|
|
|
|
|
subs => { |
17
|
|
|
|
|
|
|
form_field => sub { |
18
|
244
|
|
|
244
|
|
88684
|
$$context = $caller->form_meta->add_field(@_); |
19
|
|
|
|
|
|
|
}, |
20
|
|
|
|
|
|
|
form_cleaner => sub { |
21
|
13
|
|
|
13
|
|
824
|
$$context = undef; |
22
|
13
|
|
|
|
|
61
|
$caller->form_meta->add_hook(cleanup => @_); |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
form_hook => sub { |
25
|
11
|
|
|
11
|
|
976
|
$$context = undef; |
26
|
11
|
|
|
|
|
48
|
$caller->form_meta->add_hook(@_); |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
field_validator => sub { |
29
|
7
|
|
|
7
|
|
861
|
$caller->form_meta->add_field_validator($self->use_context($context), @_); |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
form_message => sub { |
32
|
2
|
|
|
2
|
|
158
|
$$context = undef; |
33
|
2
|
|
|
|
|
12
|
my %params = @_; |
34
|
2
|
|
|
|
|
7
|
for my $key (keys %params) { |
35
|
4
|
|
|
|
|
17
|
$caller->form_meta->add_message($key, $params{$key}); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
|
40
|
65
|
|
|
|
|
1235
|
roles => ['Form::Tiny::Form'], |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|