Validator::Lazy::Role::Notifications
Version 0.03
use Validator::Lazy; my $v = Validator::Lazy->new( $config ); my $ok = $v->check( $hashref_of_your_data_to_chech ); # true / false OR my ( $ok, $data ) = $v->check( $hashref_of_your_data_to_chech ); # true / false say Dumper $v->errors; # [ { code => any_error_code, field => field_with_error, data => { variable data for more accurate error definition } } ] say Dumper $v->warnings; # [ { code => any_warn_code, field => field_with_warn, data => { variable data for more accurate warn definition } } ] say Dumper $v->data; # Fixed data. For example trimmed strings, corrected char case, etc...
Provides "Notifications" role for Validator::Lazy, part of Validator::Lazy package.
Methods: $validator->add_error, that adding error to $validator object. $validator->add_warning, that adding warning to $validator object.
Each of these methods can be called with 0,1 or 2 params.
If param count is 0 then default error/warn will be generated.
By default it is a hash = { field => field_with_error, code => working_check_role_name . '_ERROR', data => {} }
If param count is 1: if param is a HASH, then we interpret it as "data" for error/warn hash if param is scalar then it will be error/warn code for error/warn hash
If param count is 2, then the first param is error/warn code, the 2nd is "data"
add_error
$validator->add_error( ); $validator->add_error( $code ); $validator->add_error( $data ); $validator->add_error( $code, $data );
add_warning
$validator->add_warning( ); $validator->add_warning( $code ); $validator->add_warning( $data ); $validator->add_warning( $code, $data );
errors
warnings
error_codes
warning_codes
After installing, you can find documentation for this module with the perldoc command. perldoc Validator::Lazy You can also look for information at: RT, CPAN's request tracker (report bugs here) http://rt.cpan.org/NoAuth/Bugs.html?Dist=Validator-Lazy AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/Validator-Lazy CPAN Ratings http://cpanratings.perl.org/d/Validator-Lazy Search CPAN http://search.cpan.org/dist/Validator-Lazy/
ANTONC <antonc@cpan.org>
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: L<http://www.perlfoundation.org/artistic_license_2_0>
To install Validator::Lazy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Validator::Lazy
CPAN shell
perl -MCPAN -e shell install Validator::Lazy
For more information on module installation, please visit the detailed CPAN module installation guide.