Syccess::ValidatorSimple - Syccess validator
version 0.104
package MyValidators::Custom; use Moo; with qw( Syccess::ValidatorSimple ); sub validator { my ( $self, $value ) = @_; return if $value eq 'ok'; return 'Your value for %s is not ok.'; } sub missing_ok { 1 } sub undef_ok { 1 } sub empty_ok { 1 } 1;
Please first see Syccess::Validator. This role is a wrapper around it, which requires a function validator, which will be called with the value given on the parameters for the field where the validator is used. By default, it ignores a not existing value, an undefined value or an empty string. You can override this behaviour by overloading the functions missing_ok, undef_ok or empty_ok with a sub that returns a false value. Then this specific case will still be dispatched to the validator function and can then there produce an error, or not ;).
If the value is missing, then @_ will only contain a reference to the validator object, but no value itself (if you override missing_ok).
IRC
Join irc.perl.org and msg Getty
Repository
http://github.com/Getty/p5-syccess Pull request and additional contributors are welcome
Issue Tracker
http://github.com/Getty/p5-syccess/issues
Torsten Raudssus <torsten@raudss.us>
This software is copyright (c) 2017 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Syccess, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Syccess
CPAN shell
perl -MCPAN -e shell install Syccess
For more information on module installation, please visit the detailed CPAN module installation guide.