Subject: | DUPLICATION doesn't work with undef |
It appears that this was coded on purpose, but I'm not sure that it's
the right thing to do.
unless (defined $data1 && defined $data2) {
FormValidator::Simple::Exception->throw(
qq/validation "DUPLICATION" needs two keys of data./
);
}
The problem is that it's not uncommon to have things like
password/confirm_password fields, where there are both set to NOT_BLANK,
and confirms' set to DUPLICATION(password, confirm_password). If the
user doesn't enter one of the fields, NOT_BLANK will fire, but
DUPLICATION will bail because one value is undef. Duplication has two
keys of data (two params were sent), it's just that one is undef.
I'd vote that DUPLICATION should honor the fact that it was given two
entries in @{$params} and fail the equality test. If @{$params} only
contains one value, then continue to complain that two values must be sent.
Patch forthcoming if no one objects.