8000 GitHub - vti/mojox-validator: Main functionality moved to Input::Validator
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

vti/mojox-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MojoX::Validator

my $validator = MojoX::Validator->new;

# Fields
$validator->field('phone')->required(1)->regexp(qr/^\d+$/);
$validator->field([qw/firstname lastname/])
  ->each(sub { shift->required(1)->length(3, 20) });

# Groups
$validator->field([qw/password confirm_password/])
  ->each(sub { shift->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 $pass_error = $validator->group('passwords')->error;
my $validated_values_hashref = $validator->values;

About

Main functionality moved to Input::Validator

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages

0