NAME
SweetPea::Application::Validate - Data validation for SweetPea-Application.
SYNOPSIS
... from inside SweetPea::Application or a Controller;
if $s->validate->table('/users');
METHODS
new
The new method instantiates a new SweetPea::Application::Validate object
which use Data::FormValidator as a base for validating user input.
$s->plug( 'validate', sub { return SweetPea::Application::Validate->new($s); });
input
The input method validates data input (usually from an HTML form) using
Data::FormValidator syntax.
Takes 2 arguments
arg 1 - required - validation rules (hashref)
arg 2 - optional - input parameters (hashref)
if ($s->validate->input({
form_field => param('some_field')
}, {
required => ['form_field']
})) {
...
}
or
if ($s->validate->input({required => ['form_field']}) {
...
}
table
The table method validates data input automatically using
Data::FormValidator syntax with the yaml datastore table profile supplied.
Takes 1 arguments
arg 1 - required - table yaml profile name (scalar)
if ($s->validate->table('tablename')) {
print $s->validate->msgs;
}
profile
The profile method validates data input automatically using
Data::FormValidator syntax along with the specified yaml profile under the
configuration folder.
Takes 1 arguments
arg 1 - required - table yaml profile name (scalar)
if ($s->validate->profile('yamlfile')) {
print $s->validate->msgs;
}
AUTHOR
Al Newkirk, <al.newkirk at awnstudio.com>