- From: Olivier Thereaux <ot@dev.w3.org>
- Date: Thu, 12 Aug 2004 02:19:45 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/perl/modules/W3C/LogValidator/lib/W3C/LogValidator In directory hutz:/tmp/cvs-serv16566 Modified Files: HTMLValidator.pm Log Message: start documenting API, URI listing modification, versioning test Index: HTMLValidator.pm =================================================================== RCS file: /sources/public/perl/modules/W3C/LogValidator/lib/W3C/LogValidator/HTMLValidator.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- HTMLValidator.pm 10 Aug 2004 05:27:05 -0000 1.12 +++ HTMLValidator.pm 12 Aug 2004 02:19:43 -0000 1.13 @@ -15,7 +15,7 @@ our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw(); -our $VERSION = q$Revision$q; +our $VERSION = sprintf "%d.%03d",q$Revision$ =~ /(\d+)\.(\d+)/; @@ -53,13 +53,16 @@ $self->{AUTH_EXT} = ".html .xhtml .phtml .htm .shtml .php .svg .xml /"; } if (exists $config{verbose}) {$verbose = $config{verbose}} + @{$self->{URIs}} = undef; bless($self, $class); return $self; } sub uris { - #unused + my $self = shift; + if (@_) { @{$self->{URIs}} = @_ } + return @{$self->{URIs}}; } @@ -342,18 +345,74 @@ =head1 SYNOPSIS use W3C::LogValidator::HTMLValidator; - my $validator = new W3C::LogValidator::HTMLValidator; - my $max_invalid = 12; - # how many log entries are parsed and returned before we stop - # 0 -> processes everything - $validator->uris('http://www.w3.org/', 'http://my.web.server/my/web/page.html'); - my $result_string= $validator->process_list($max_invalid); + @@ todo @@ + my $validator = W3C::LogValidator::HTMLValidator->new(\%config);; + my $result_string= $validator->process_list; =head1 DESCRIPTION This module is part of the W3C::LogValidator suite, and checks HTML validity of a given document via the W3C HTML validator service. + +=over 2 + +=item $val = W3C::LogValidator::HTMLValidator->new + +=back + +=over 4 + +=item $val->process_list + + +=item $val->trim_uris + +Given a list of URIs of documents to process, returns a subset of this list containing the URIs of documents the module supposedly can handle. +The decision is made based on file extensions (see C<auth_ext>) and content-type (see C<HEAD_check>) + +=item $val->HEAD_check +Checks whether a document with no extension is actually an HTML/XML document through an HTTP HEAD request +returns 1 if the URI is of an expected content-type, 0 otherwise + +=item $val->auth_ext + +Returns the file extensions (space separated entries in a string) supported by the Module. +Public method accessing $self->{AUTH_EXT}, itself coming from either the AuthorizedExtensions configuration setting, or a default value + +=item $val->valid + +Sets / Returns whether the document being processed has been found to be valid or not. +If an argument is given, sets the variable, otherwise returns the current variable. + +=item $val->valid_err_num + +Sets / Returns the number of validation errors for the document being processed. +If an argument is given, sets the variable, otherwise returns the current variable. + +=item $val->valid_success + +Sets / Returns whether the module was able to process validation of the current document successfully (regardless of valid/invalid result) +If an argument is given, sets the variable, otherwise returns the current variable. + +=item $val->valid_head + +Sets / Returns all HTTP headers returned by the markup validator when attempting to validate the current document. +If an argument is given, sets the variable, otherwise returns the current variable. + +=item $val->new_doc + +Resets all validation variables to 'undef'. In effect, prepares the processing module to the handling of a new document. + +=back + +=head1 BUGS + +Public bug-tracking interface at L<http://www.w3.org/Bugs/Public/> + + + + =head1 AUTHOR Olivier Thereaux <ot@w3.org>
Received on Thursday, 12 August 2004 02:19:45 UTC