Dancer2-Plugin-FormValidator

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/FormValidator.pm  view on Meta::CPAN


=head3 alpha

    alpha(Str $encoding = 'a'): Bool

Validate that string only contain of alphabetic symbols.
By default encoding is ascii, i.e B</^[[:alpha:]]+$/a>.

    field => [ qw(alpha) ]

To set encoding to unicode you need to pass 'u' argument:

    field => [ qw(alpha:u) ]

Then the validation rule will be B</^[[:alpha:]]+$/>.

=head3 alpha_num

    alpha_num(Str $encoding = 'a'): Bool

Validate that string only contain of alphabetic symbols, underscore and numbers 0-9.
By default encoding is ascii, i.e. B</^\w+$/a>.

    field => [ qw(alpha_num) ]

To set encoding to unicode you need to pass 'u' argument:

    field => [ qw(alpha_num:u) ]

Rule will be B</^\w+$/>.

=head3 boolean

    boolean(): Bool

Validate that field is 0 or 1 scalar value.



( run in 0.282 second using v1.01-cache-2.11-cpan-f29a10751f0 )