Slovo::Validator - additional validator filters and checks
Slovo::Validator inherits all checks from Mojolicious::Validator and implements the following new ones.
A custom check -- some code reference which returns true on success, false otherwise.
# in the action $v->required('id')->is(\&_writable_by, $c->stranici, $c->user); # in the same or parent controller sub _writable_by ($v, $id_name, $id_value, $m, $user) { return !!$m->find_where({$id_name => $id_value, %{$m->writable_by($user)}}); } # or simply $v->required('sum')->is(sub($v, $name, $value) { $v->param('one') + $v->param('two') == $value });
Slovo::Validator inherits all filters from Mojolicious::Validator and implements the following new ones.
$v->required('alias', 'slugify')->size(0, 255);
Generate URL slug for bytestream with "slugify" in Mojo::Util.
$c->validation->optional(title => xml_escape => 'trim')->size(10, 255);
Uses "xml_escape" in Mojo::Util to escape unsafe characters. Returns the escaped string.
Mojolicious::Validator, "Form-validation" in Mojolicious::Guides::Rendering
To install Slovo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Slovo
CPAN shell
perl -MCPAN -e shell install Slovo
For more information on module installation, please visit the detailed CPAN module installation guide.