Validator::Var - variable validator with expandable list of checkers.
Version 0.03
use Validator::Var; my $var; ... my $num_bitween = Validator::Var->new(); $foo->checker(Between, 0, 100); unless ( $foo->is_valid( $var ) ) { warn "variable is not bitween 0 an 100"; } my $number = Validator::Var->new(); $number->checker(Regexp, '^d+$'); unless ( $bar->is_valid( $var ) ) { warn "variable is not a number"; } my $ref_validator = Validator::Var->new(); $ref_validator->checker(Ref, qw(REF Foo Bar)); unless ( $bar->is_valid( $var ) ) { warn "variable is not a number"; } ...
Creates new variable validator. If at_least_one is provided and it is true validation will be passed if passed through at least one checker.
at_least_one
Checks if variable validator has no any checker.
Set (append) new checker.
Checks if variable value is valid according to specified checkers. Trace data will be gathered if do_trace is provided and it is true.
do_trace
Print trace of variable checking. format specifies format string of trace messages. Recognizes the following macro:
format
Replaced by checker's name.
Replaced by checker's arguments.
Replaced by checker's description.
Replaced by 'passed' or 'failed'.
Default format string is "Checker %name%(%args%) - %desc% ... %result%".
"Checker %name%(%args%) - %desc% ... %result%"
Fedor Semenov, <fedor.v.semenov at gmail.com>
<fedor.v.semenov at gmail.com>
Please report any bugs or feature requests to bug-validator-var at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Validator-Var. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-validator-var at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Validator::Var
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Validator-Var
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Validator-Var
CPAN Ratings
http://cpanratings.perl.org/d/Validator-Var
Search CPAN
http://search.cpan.org/dist/Validator-Var/
Copyright 2011 Fedor Semenov.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Validator::Var, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Validator::Var
CPAN shell
perl -MCPAN -e shell install Validator::Var
For more information on module installation, please visit the detailed CPAN module installation guide.