#!/usr/bin/env perl
use_ok(
'Data::FormValidator'
);
my
$err_re
=
qr/not a code ref/
;
{
my
%profile
= (
required
=> [
'zip'
],
constraint_methods
=> {
zip
=>
'zip'
,
} );
my
%data
= (
zip
=> 56567 );
eval
{
my
$r
= Data::FormValidator->check( \
%data
, \
%profile
) };
like( $@,
$err_re
,
"error thrown when given a string to constraint_method"
);
}
{
my
%profile
= (
required
=> [
'zip'
],
constraint_methods
=> {
zip
=> [
'zip'
],
} );
my
%data
= (
zip
=> 56567 );
eval
{
my
$r
= Data::FormValidator->check( \
%data
, \
%profile
) };
like( $@,
$err_re
,
"error thrown when given a string to constraint_method...even as part of a list."
);
}
{
my
%profile
= (
required
=> [
'zip'
],
untaint_all_constraints
=> 1,
constraint_methods
=> {
zip
=> {} } );
my
%data
= (
zip
=> 56567 );
eval
{
my
$r
= Data::FormValidator->check( \
%data
, \
%profile
) };
like( $@,
$err_re
,
"error thrown when given a string to constraint_method...even as hash declaration."
);
}