Form::Tiny::Filter - a representation of a filter
# in your form class # the following will be coerced into Form::Tiny::Filter form_filter Str, sub { uc pop() };
This is a simple class which stores a Type::Tiny type and a sub which will perform the filtering.
A Type::Tiny type that will be checked against.
Required.
A code reference ($form, $value) and performing the filtering. The scalar $value will already be checked against the type. Should return modified $value.
($form, $value)
$value
$filtered = $filter->filter($filtered, $form);
Checks if $filtered matches the type and runs the code reference. $form is a form instance in which the filtering happens, and will be passed before $filtered. The $filtered value is the last parameter to the coderef, so it can be retrieved using pop().
$filtered
$form
pop()
The return value is the scalar value, either changed or unchanged.
To install Form::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Form::Tiny
CPAN shell
perl -MCPAN -e shell install Form::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.