File Coverage

blib/lib/HTML/FormFu/Plugin.pm
Criterion Covered Total %
statement 12 15 80.0
branch n/a
condition n/a
subroutine 6 10 60.0
pod 5 6 83.3
total 23 31 74.1


line stmt bran cond sub pod time code
1 3     3   1753 use strict;
  3         8  
  3         163  
2              
3             package HTML::FormFu::Plugin;
4             $HTML::FormFu::Plugin::VERSION = '2.07';
5             # ABSTRACT: base class for plugins
6              
7 3     3   18 use Moose;
  3         8  
  3         16  
8 3     3   20643 use MooseX::Attribute::Chained;
  3         9  
  3         155  
9              
10             with 'HTML::FormFu::Role::HasParent', 'HTML::FormFu::Role::Populate';
11              
12 3     3   21 use HTML::FormFu::ObjectUtil qw( form parent );
  3         9  
  3         728  
13              
14             has type => ( is => 'rw', traits => ['Chained'] );
15              
16       2 1   sub pre_process { }
17              
18       2 1   sub process { }
19              
20       0 1   sub post_process { }
21              
22       0 1   sub render { }
23              
24       0 1   sub post_render { }
25              
26             sub clone {
27 0     0 0   my ($self) = @_;
28              
29 0           my %new = %$self;
30              
31 0           return bless \%new, ref $self;
32             }
33              
34             __PACKAGE__->meta->make_immutable;
35              
36             1;
37              
38             __END__
39              
40             =pod
41              
42             =encoding UTF-8
43              
44             =head1 NAME
45              
46             HTML::FormFu::Plugin - base class for plugins
47              
48             =head1 VERSION
49              
50             version 2.07
51              
52             =head2 DESCRIPTION
53              
54             Plugins can be added to a form or any element to modify their behaviour.
55             Some plugins should only be added to either a form, or an element, depending
56             on their design.
57              
58             =head1 METHODS
59              
60             Plugins can override any of the following method stubs.
61              
62             =head2 process
63              
64             Only plugins added to a form or a field element inheriting from
65             L<HTML::FormFu::Role::Element::Field> will have their C<process> method run.
66              
67             For form plugins, is called during L<HTML::FormFu/process>, before C<process>
68             is called on any elements.
69              
70             For field plugins, is called during the field's C<process> call.
71              
72             =head2 pre_process
73              
74             For form plugins, is called immediately after C<pre_process>
75             is run on the elements.
76              
77             For element plugins, is called before C<pre_process> is run on form plugins.
78              
79             =head2 post_process
80              
81             For form plugins, is called immediately before L<HTML::FormFu/process>
82             returns.
83              
84             For element plugins, is called before C<post_process> is run on form plugins.
85              
86             =head2 render
87              
88             Only plugins added to a form will have their C<render> method run.
89              
90             Is called during L<HTML::FormFu/render> before the
91             L<HTML::FormFu/render_method> is called.
92              
93             =head2 post_render
94              
95             Only plugins added to a form will have their C<post_render> method run.
96              
97             Is called during L<HTML::FormFu/render> immediately before
98             L<HTML::FormFu/render> return.
99              
100             Is passed a reference to the return value of L<HTML::FormFu/render_method>.
101              
102             =head1 CORE PLUGINS
103              
104             =over
105              
106             =item L<HTML::FormFu::Plugin::StashValid>
107              
108             =back
109              
110             =head1 AUTHOR
111              
112             Carl Franks, C<cfranks@cpan.org>
113              
114             =head1 LICENSE
115              
116             This library is free software, you can redistribute it and/or modify it under
117             the same terms as Perl itself.
118              
119             =head1 AUTHOR
120              
121             Carl Franks <cpan@fireartist.com>
122              
123             =head1 COPYRIGHT AND LICENSE
124              
125             This software is copyright (c) 2018 by Carl Franks.
126              
127             This is free software; you can redistribute it and/or modify it under
128             the same terms as the Perl 5 programming language system itself.
129              
130             =cut