Subject: | Errors in the code as well as possible "warnings" value misinterpretation |
First of all, the code on line 23 reads:
# warnings level currently supported by the W3C CSS Validator
our $WARNINGS = map { $_ => 1 } qw/0 1 2 no/;
Which assigns value '8' to $WARNINGS, I believe the author
really ment %WARNINGS.
Secondly, line 129 reads:
if (defined $parm{warnings}) {
Carp::croak "warnings must be an integer 0 - 10\n"
unless $parm{warnings} =~ /^[0-9]|10$/;
if ($parm{warnings} == 0) {
$uri->query_param(warning => "no");
}
else {
$uri->query_param(warning => $parm{warnings});
}
}
This has two problems:
First, it sets 'no warnings' if the passed value is '0' and otherwise
sets whatever passed value is. However, the current validator
has value 'no' for 'no warnings' and '0' means "Most Important"
Though, I am not exactly sure if the SOAP interface behaves in a
similiar fashion.
Second, the regex which checks the parameter reads:
"starts with 0-9 or ends with 10"
It should be /^([0-9]|10)$/
If I am correct about warnings level the code should read:
if (defined $parm{warnings}) {
Carp::croak "warnings must be an integer 0 - 10 or word 'no'\n"
unless $parm{warnings} =~ /^([0-9]|10|no)$/;
$uri->query_param(warning => $parm{warnings});
}
(and the docs updated of course)
Cheers