Validate-Tiny
view release on metacpan or search on metacpan
t/filters/03-case.t view on Meta::CPAN
use strict;
use warnings;
use Validate::Tiny ':all';
use Test::More;
my $rules = {
fields => [qw/a b c/],
filters => [ a => filter('lc'), b => filter('uc'), c => filter('ucfirst') ]
};
my $input = {
a => 'BAR',
b => 'foo',
c => 'baz'
};
my $res = validate({a => undef}, $rules);
is $res->{a}, undef;
$res = validate($input, $rules);
is $res->{data}->{a}, 'bar', "lc";
is $res->{data}->{b}, 'FOO', "uc";
is $res->{data}->{c}, 'Baz', "ucfirst";
done_testing;
( run in 0.653 second using v1.01-cache-2.11-cpan-140bd7fdf52 )