Allow negative values in validation...
This commit is contained in:
parent
63ba894260
commit
71057b54a9
@ -1357,8 +1357,8 @@ sub validate {
|
|||||||
foreach my $value (@values) {
|
foreach my $value (@values) {
|
||||||
if ($type eq 'i' || $type eq 'f') {
|
if ($type eq 'i' || $type eq 'f') {
|
||||||
die "Invalid value for $opt_key\n"
|
die "Invalid value for $opt_key\n"
|
||||||
if ($type eq 'i' && $value !~ /^\d+$/)
|
if ($type eq 'i' && $value !~ /^-?\d+$/)
|
||||||
|| ($type eq 'f' && $value !~ /^(?:\d+|\d*\.\d+)$/)
|
|| ($type eq 'f' && $value !~ /^-?(?:\d+|\d*\.\d+)$/)
|
||||||
|| (defined $opt->{min} && $value < $opt->{min})
|
|| (defined $opt->{min} && $value < $opt->{min})
|
||||||
|| (defined $opt->{max} && $value > $opt->{max});
|
|| (defined $opt->{max} && $value > $opt->{max});
|
||||||
} elsif ($type eq 's' && $opt->{type} eq 'select') {
|
} elsif ($type eq 's' && $opt->{type} eq 'select') {
|
||||||
|
Loading…
Reference in New Issue
Block a user