line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Factory::Feature::Functional; |
2
|
|
|
|
|
|
|
$Form::Factory::Feature::Functional::VERSION = '0.022'; |
3
|
1
|
|
|
1
|
|
4
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
with qw( |
6
|
|
|
|
|
|
|
Form::Factory::Feature |
7
|
|
|
|
|
|
|
Form::Factory::Feature::Role::Clean |
8
|
|
|
|
|
|
|
Form::Factory::Feature::Role::Check |
9
|
|
|
|
|
|
|
Form::Factory::Feature::Role::PreProcess |
10
|
|
|
|
|
|
|
Form::Factory::Feature::Role::PostProcess |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ABSTRACT: A generic feature for actions |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has cleaner_code => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => 'HashRef[CodeRef]', |
19
|
|
|
|
|
|
|
required => 1, |
20
|
|
|
|
|
|
|
default => sub { {} }, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has checker_code => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
isa => 'HashRef[CodeRef]', |
27
|
|
|
|
|
|
|
required => 1, |
28
|
|
|
|
|
|
|
default => sub { {} }, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has pre_processor_code => ( |
33
|
|
|
|
|
|
|
is => 'ro', |
34
|
|
|
|
|
|
|
isa => 'HashRef[CodeRef]', |
35
|
|
|
|
|
|
|
required => 1, |
36
|
|
|
|
|
|
|
default => sub { {} }, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has post_processor_code => ( |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
isa => 'HashRef[CodeRef]', |
43
|
|
|
|
|
|
|
required => 1, |
44
|
|
|
|
|
|
|
default => sub { {} }, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub clean { |
49
|
9
|
|
|
9
|
1
|
11
|
my $self = shift; |
50
|
9
|
|
|
|
|
11
|
$_->($self->action, @_) for values %{ $self->cleaner_code }; |
|
9
|
|
|
|
|
280
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub check { |
55
|
9
|
|
|
9
|
1
|
12
|
my $self = shift; |
56
|
9
|
|
|
|
|
11
|
$_->($self->action, @_) for values %{ $self->checker_code }; |
|
9
|
|
|
|
|
277
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub pre_process { |
61
|
3
|
|
|
3
|
1
|
4
|
my $self = shift; |
62
|
3
|
|
|
|
|
4
|
$_->($self->action, @_) for values %{ $self->pre_processor_code }; |
|
3
|
|
|
|
|
104
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub post_process { |
67
|
3
|
|
|
3
|
1
|
5
|
my $self = shift; |
68
|
3
|
|
|
|
|
4
|
$_->($self->action, @_) for values %{ $self->post_processor_code }; |
|
3
|
|
|
|
|
97
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=pod |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=encoding UTF-8 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 NAME |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Form::Factory::Feature::Functional - A generic feature for actions |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 VERSION |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
version 0.022 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 SYNOPSIS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
package MyApp::Action::Foo; |
90
|
|
|
|
|
|
|
use Form::Factory::Processor; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
has_cleaner squeaky => sub { |
93
|
|
|
|
|
|
|
my $action = shift; |
94
|
|
|
|
|
|
|
# clean up the action input here... |
95
|
|
|
|
|
|
|
}; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
has_checker black_or_read => sub { |
98
|
|
|
|
|
|
|
my $action = shift; |
99
|
|
|
|
|
|
|
# check the action input here... |
100
|
|
|
|
|
|
|
}; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
has_pre_processor remember_cpp => sub { |
103
|
|
|
|
|
|
|
my $action = shift; |
104
|
|
|
|
|
|
|
# run code just before processing here... |
105
|
|
|
|
|
|
|
}; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
has_post_processor industrial_something => sub { |
108
|
|
|
|
|
|
|
my $action = shift; |
109
|
|
|
|
|
|
|
# run code just after processing here... |
110
|
|
|
|
|
|
|
}; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 DESCRIPTION |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
You probably don't want to use this feature directly. The various helpers imported when you use L<Form::Factory::Processor> actually use this feature for implementation. You probably want to use those instead. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 cleaner_code |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
An array of subroutines to run during the clean phase. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 checker_code |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
An array of subroutines to run during the check phase. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 pre_processor_code |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
An array of subroutines to run during the pre-process phase. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 post_process_code |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
An array of subroutines to run during the post-process phase. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 METHODS |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 clean |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Run all the subroutines in L</cleaner_code>. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 check |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Run all the subroutines in L</checker_code>. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 pre_process |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Run all the subroutines in L</pre_processor_code>. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 post_process |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Run all the subroutines in L</post_processor_code>. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 AUTHOR |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Andrew Sterling Hanenkamp <hanenkamp@cpan.org> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Qubling Software LLC. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
161
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |