NAME
Dancer::Plugin::FormValidator - easy validates user input (usually from an HTML form) based on input profile for Dancer applications.
SYNOPSIS
use Dancer;
use Dancer::Plugin::FormValidator;
get '/contact/form' => sub {
my $input_hash = {
Name = $params->{name};
Subject = $params->{subject};
Body = $params->{body};
};
my $error = form_validator_error( 'profil_contact', $input_hash );
if ( ! $error ) {
#the user provided complete and validates
# data it's cool to proceed
}
};
dance;
The profile_file example:
{
add_page => {
'required' => [ qw(
Name Subject Body
)],
msgs => {
missing => 'Not Here!',
}
},
}
DESCRIPTION
Provides an easy validates user input based on input profile (Data::FormValidator) keyword within your Dancer application.
CONFIGURATION
plugins:
FormValidator:
profil_file: '/path/to/profiles.pl'
halt: 0
msg:
single: 'Missing field'
several: 'Missing fields'
If you don't use halt, a hashref is return with name of fields for the key and reason of the value use msgs profile, if you missing specified a msgs in a profil, msg single is use.
AUTHOR
Natal Ngétal, <hobbestigrou@erakis.im>
CONTRIBUTING
This module is developed on Github at:
http://github.com/hobbestigrou/Dancer-Plugin-FormValidator
Feel free to fork the repo and submit pull requests
ACKNOWLEDGEMENTS
Alexis Sukrieh and Franck Cuny
BUGS
Please report any bugs or feature requests in github.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Dancer::Plugin::FormValidator
LICENSE AND COPYRIGHT
Copyright 2010 Natal Ngétal.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
SEE ALSO
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 140:
Non-ASCII character seen before =encoding in 'Ngétal,'. Assuming UTF-8