- From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 18 Jan 2007 02:40:35 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/perl/modules/WebService/Validator/Feed/lib/WebService/Validator/Feed In directory hutz:/tmp/cvs-serv21082/lib/WebService/Validator/Feed Modified Files: W3C.pm Log Message: removing workarounds for old versions of SOAP::Lite module, requiring version > 0.65 Index: W3C.pm =================================================================== RCS file: /sources/public/perl/modules/WebService/Validator/Feed/lib/WebService/Validator/Feed/W3C.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- W3C.pm 26 Apr 2006 00:18:58 -0000 1.4 +++ W3C.pm 18 Jan 2007 02:40:33 -0000 1.5 @@ -2,14 +2,14 @@ use strict; use warnings; -use SOAP::Lite; +use SOAP::Lite 0.65; use LWP::UserAgent qw//; use URI qw//; use URI::QueryParam qw//; use Carp qw//; use base qw/Class::Accessor/; -our $VERSION = "0.3"; +our $VERSION = "0.4"; __PACKAGE__->mk_accessors qw/user_agent validator_uri/; __PACKAGE__->mk_ro_accessors qw/response request_uri som success/; @@ -53,15 +53,6 @@ local $_ = $res->content; - - # workaround for SOAP::Lite's lack of support for SOAP 1.2 - s{xmlns:env="http://www.w3.org/2003/05/soap-envelope"} - {xmlns:env="http://www.w3.org/2001/06/soap-envelope"}; - - # workaround for SOAP::Lite's lack of support for SOAP 1.2 - s{env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"} - {env:encodingStyle="http://www.w3.org/2001/06/soap-encoding"}; - my $som; eval { $som = SOAP::Deserializer->new->deserialize($_); }; @@ -80,11 +71,11 @@ # check whether this is really the Feed Validator responding if ($som->match("/Envelope/Body/feedvalidationresponse")) { $self->{'success'} = 1; - } + } # if the response was a SOAP fault - elsif ($som->match("/Envelope/Body/Fault")) { - $self->{'success'} = 0; - } + elsif ($som->match("/Envelope/Body/Fault")) { + $self->{'success'} = 0; + } # return whether the response was successfully processed return $self->{'success'}; @@ -161,25 +152,25 @@ return () unless defined $som; return $som->valueof("//warning"); -} - -sub errorcount -{ - my $self = shift; - my $som = $self->som; - - return () unless defined $som; - return $som->valueof("//errorcount"); -} - -sub warningcount -{ - my $self = shift; - my $som = $self->som; - - return () unless defined $som; - return $som->valueof("//warningcount"); -} +} + +sub errorcount +{ + my $self = shift; + my $som = $self->som; + + return () unless defined $som; + return $som->valueof("//errorcount"); +} + +sub warningcount +{ + my $self = shift; + my $som = $self->som; + + return () unless defined $som; + return $som->valueof("//warningcount"); +} @@ -199,7 +190,7 @@ my $feed_url = "http://www.example.com"; my $val = WebService::Validator::Feed::W3C->new; - my $ok = $val->validate(url => $feed_url); + my $ok = $val->validate(uri => $feed_url); if ($ok and !$val->is_valid) { print "Errors:\n"; @@ -209,8 +200,8 @@ =head1 DESCRIPTION -This module is an interface to the W3C Feed Validation online service -L<http://validator.w3.org/feed/>, based on its SOAP 1.2 support. +This module is an interface to the W3C Feed Validation online service +L<http://validator.w3.org/feed/>, based on its SOAP 1.2 support. It helps to find errors in RSS or Atom feeds. The following methods are available: @@ -265,19 +256,19 @@ synopsis would currently return something like ( { - type -> 'MissingDescription', - line => '23', - column => '0', - text => 'Missing channel element: description', - element =>description, - parent =>channel, + type -> 'MissingDescription', + line => '23', + column => '0', + text => 'Missing channel element: description', + element =>description, + parent =>channel, } ) =item my @warnings = $val->warnings Returns a list with information about the warnings found for the -feed +feed @@example @@ -326,15 +317,15 @@ =head1 NOTE -Please remember that the Feed Validation service is a shared resource, +Please remember that the Feed Validation service is a shared resource, so do not abuse it: you should make your scripts sleep between requests. - + =head1 AUTHOR - -olivier Thereaux <ot@w3.org> -Based on the WebService::Validator::CSS::W3C module +olivier Thereaux <ot@w3.org> + +Based on the WebService::Validator::CSS::W3C module by Bjoern Hoehrmann <bjoern@hoehrmann.de> et.al. This module is licensed under the same terms as Perl itself.
Received on Thursday, 18 January 2007 02:40:40 UTC