1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!perl
use Test::More 'no_plan';
use Data::FormValidator;
use Data::FormValidator::Constraints qw(
FV_max_length
);
my $result = Data::FormValidator->check({
first_names => 'Too long',
},
{
required => [qw/first_names/],
constraint_methods => {
first_names => {
constraint_method => FV_max_length(3),
name => 'custom_length',
}
},
msgs => {
constraints => {
custom_length => 'Custom length msg',
}
},
});
like( $result->msgs->{'first_names'}, qr/Custom length msg/, "built-ins can have custom names" );
|