- PUBLIC METHODS
- PRIVATE METHODS
- COPYRIGHT AND LICENSE
Chloro::Role::Form - A role for form classes
package MyApp::Form::Login; # define fields my $form = MyApp::Form::Login->new(); my $resultset = $form->process( params => $params );
When you write a class or role which
uses Chloro, your class or role will automatically consume this role.
This role implements most of the logic related to process a user's form submission. You can provide custom versions of some of these methods to change how this processing is done.
This role provides the following public methods:
This returns the ungrouped Chloro::Field objects for the form.
This returns the Chloro::Group objects for the form.
This method takes a hash reference of user-submitted form data and processes it. The hash reference should contain field names (as found in the HTML form) as keys.
This role also provides a number of private methods. Some are for Chloro's use only, but some of them are designed so that you can provide your own alternate implementation.
This returns the name of the class that should be used for the form's resultset. This defaults to Chloro::ResultSet, but you can provide your own class.
If you provide a custom resultset class, you should extend Chloro::ResultSet.
This method will be called with two arguments. The first is the raw parameters passed to
$form->process(). The second is a hash reference where the keys are field and group names and the values are Chloro::Result::Field and Chloro::Result::Group objects.
By default, this is a no-op method, but you can provide your own implementation to do whole form validation. See Chloro::Manual::Intro for an example.
Bugs may be submitted at http://rt.cpan.org/Public/Dist/Display.html?Name=Chloro or via email to email@example.com.
I am also usually active on IRC as 'autarch' on
The source code repository for Chloro can be found at https://github.com/autarch/Chloro.
Dave Rolsky <firstname.lastname@example.org>
This software is Copyright (c) 2017 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
The full text of the license can be found in the LICENSE file included with this distribution.