MongoDBx::Tiny::Validator - validation on insert and update.
$validator = MongoDBx::Tiny::Validator->new( $collection_name, $document, $tiny, );
# alias $document = $validator->document; $collection_name = $validator->collection_name; $tiny = $validator->tiny;
$validator->has_error && die;
$validator->set_error( $name => [ 'error-code','message', ] );
# erros: [{ field => 'field1', code => 'errorcode', message => 'message1' },,,] @erros = $validator->erros; @fields = $validator->errors('field'); @error_code = $validator->errors('code'); @error_message = $validator->errors('message');
# no_validate: bool # state: [insert,update] $validator->check($opt);
Naoto ISHIKAWA, <toona at seesaa.co.jp>
<toona at seesaa.co.jp>
Copyright 2013 Naoto ISHIKAWA.
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 MongoDBx::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MongoDBx::Tiny
CPAN shell
perl -MCPAN -e shell install MongoDBx::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.