package HTML::FormFu::Plugin; use Moose; with 'HTML::FormFu::Role::HasParent', 'HTML::FormFu::Role::Populate'; use HTML::FormFu::ObjectUtil qw( form parent ); use Scalar::Util qw( refaddr reftype ); use Carp qw( croak ); has type => ( is => 'rw', traits => ['Chained'] ); sub pre_process { } sub process { } sub post_process { } sub render { } sub post_render { } sub clone { my ($self) = @_; my %new = %$self; return bless \%new, ref $self; } __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu::Plugin - base class for plugins =head2 DESCRIPTION Plugins can be added to a form or any element to modify their behaviour. Some plugins should only be added to either a form, or an element, depending on their design. =head1 METHODS Plugins can override any of the following method stubs. =head2 process Only plugins added to a form or a field element inheriting from L will have their C method run. For form plugins, is called during L, before C is called on any elements. For field plugins, is called during the field's C call. =head2 post_process For form plugins, is called immediately before L returns. For element plugins, is called before C is run on form plugins. =head2 render Only plugins added to a form will have their C method run. Is called during L before the L is called. =head2 post_render Only plugins added to a form will have their C method run. Is called during L immediately before L return. Is passed a reference to the return value of L. =head1 CORE PLUGINS =over =item L =back =head1 AUTHOR Carl Franks, C =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut