Subject: | type => UNDEF, regex => qr/.../ performs a regex check on the value |
Currently, if a parameter has UNDEF as one of the acceptable types, then
an undef value will still be checked by a regex validation (after being
coerced to an empty string). This means that the regex validation must
handle this scenario.
It seems to me that the UNDEF type should take precedence here and avoid
the regex check.
I stumbled upon this recently because I had to use { type => SCALAR|UNDEF,
regex => qr/^(foo|bar|)$/ } instead of what I really wanted to express, {
type => SCALAR|UNDEF, regex => qr/^(foo|bar)$/ }.