SweetPea::Application::Validate - Data validation for SweetPea-Application.
... from inside SweetPea::Application or a Controller; if $s->validate->table('/users');
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); });
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']}) { ... }
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; }
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; }
Al Newkirk, <al.newkirk at awnstudio.com>
<al.newkirk at awnstudio.com>
To install SweetPea::Application, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SweetPea::Application
CPAN shell
perl -MCPAN -e shell install SweetPea::Application
For more information on module installation, please visit the detailed CPAN module installation guide.