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