Subject: | Error when using "email" for a constraint. |
Hi.
If i run the script below (or a wrapper i have built for D::FV), and i use "email" for a constraint, an invalid field changes the value of that field to an array reference instead of the invalid value. If an email address passes, it is left alone.
My system is fedora core 1 with perl 5.8.3 and Data::FormValidator 3.54.
Below is my example script and the sample output.
use Data::FormValidator;
%VAR1 = (
'create' => 'Create New Category',
'name' => ' asdf ',
'sort_position' => '1',
'description' => ' asdf ',
'email_addy' => 'jasonmultiply.org'
);
my $profile = {
optional => [qw( description )],
required => [qw( name
email_addy )],
constraints => {
email_addy => 'email'
}
};
my $results = Data::FormValidator->check(\%VAR1, $profile);
use Data::Dumper;
print Dumper( $results );
----------------
OUTPUT:
----------------
$VAR1 = bless( {
'profile' => {
'defaults' => {},
'dependencies' => {},
'optional' => [
'description'
],
'dependency_groups' => {},
'constraint_regexp_map' => {},
'constraints' => {
'email_addy' => 'email'
},
'required' => [
'name',
'email_addy'
],
'require_some' => {},
'field_filter_regexp_map' => {},
'field_filters' => {}
},
'validate_invalid' => [
'email_addy'
],
'__INPUT_DATA' => {
'create' => 'Create New Category',
'sort_position' => '1',
'email_addy' => 'jasonmultiply.org',
'name' => ' asdf ',
'description' => ' asdf '
},
'missing' => {},
'__CURRENT_CONSTRAINT_FIELD' => 'email_addy',
'__CURRENT_CONSTRAINT_VALUE' => 'jasonmultiply.org',
'valid' => {
'name' => ' asdf ',
'description' => ' asdf '
},
'__CURRENT_CONSTRAINT_NAME' => 'email',
'unknown' => {
'create' => 1,
'sort_position' => 1
},
'invalid' => {
'email_addy' => [
'email'
]
}
}, 'Data::FormValidator::Results' );