Skip Menu |

This queue is for tickets about the WebService-Validator-CSS-W3C CPAN distribution.

Report information
The Basics
Id: 33039
Status: resolved
Priority: 0/
Queue: WebService-Validator-CSS-W3C

People
Owner: oliviert [...] cpan.org
Requestors: cpan [...] zoffix.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 0.3



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
On Fri Feb 08 17:35:21 2008, ZOFFIX wrote: Show quoted text
> 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.
Looks like it, yes. Looking at code, it seems %WARNINGS isn't used at all. Show quoted text
> Secondly, line 129 reads:
I fixed that to be: [[ if (defined $parm{warnings}) { Carp::croak "warnings must be either \"no\" or an integer from 0 to 2\n" unless $WARNINGS{$parm{warnings}}; $uri->query_param(warning => $parm{warnings}); } ]] and updated the doc: http://lists.w3.org/Archives/Public/www-validator-cvs/2008Feb/0050.html thanks, -- olivier