NAME
MojoX::Validator - Validator for Mojolicious
SYNOPSIS
my $validator = MojoX::Validator->new;
# Fields
$validator->field([qw/firstname lastname/])->required(1)->length(3, 20);
$validator->field('phone')->required(1)->regexp(qr/^\d+$/);
# Groups
$validator->field([qw/password confirm_password/])->required(1);
$validator->group('passwords' => [qw/password confirm_password/])->equal;
# Conditions
$validator->field('document');
$validator->field('number');
$validator->when('document')->regexp(qr/^1$/)
->then(sub { shift->field('number')->required(1) });
$validator->validate($values_hashref);
my $errors_hashref = $validator->errors;
my $validated_values_hashref = $validator->values;
DESCRIPTION
DEVELOPMENT
Repository
http://github.com/vti/mojox-validator
AUTHOR
Viacheslav Tykhanovskyi, vti@cpan.org
.
COPYRIGHT AND LICENSE
Copyright (C) 2010, Viacheslav Tykhanovskyi.
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.