Commit 81bba0f2 authored by Nigel Kukard's avatar Nigel Kukard

Cleaned up regex validation some more

parent 438dff86
......@@ -1282,25 +1282,14 @@ sub _init
$property->{'validate'}->{'type'} = "regex";
}
# We must always have a type
# Check if we have a type set
if (!defined($property->{'validate'}->{'type'})) {
$self->_log(DATAOBJ_LOG_ERROR,"Property '%s' has no validation",$propertyName);
$self->_log(DATAOBJ_LOG_ERROR,"Property '%s' has no validation type set",$propertyName);
}
# Check that the regex type has a regex argument
# We need the 'regex' option for regexes
if ($property->{'validate'}->{'type'} eq "regex" && !defined($property->{'validate'}->{'regex'})) {
$self->_log(DATAOBJ_LOG_ERROR,"Property '%s' has a regex validation type, but no regex",$propertyName);
}
# Check that the regex type has a regex argument
if (defined($property->{'validate'}->{'regex'}) && ref($property->{'validate'}->{'regex'}) ne "Regexp") {
$self->_log(DATAOBJ_LOG_ERROR,"Property '%s' has a regex match but not a type consistent with qr( /.../ )",
$propertyName);
}
# Check if we have a type set
if (!defined($property->{'validate'}->{'type'})) {
$self->_log(DATAOBJ_LOG_ERROR,"Property '%s' has no validation type set",$propertyName);
$self->_log(DATAOBJ_LOG_ERROR,"Property '%s' has a regex validation type, but no regex",$propertyName);
}
$self->_log(DATAOBJ_LOG_DEBUG2," - Property '%s' has validation type '%s'",$propertyName,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment