Re: [code-review] WebService::Validator::HTML::W3C

darren chamberlain <[email protected]> Fri, 14 Nov 2003 13:15:19 -0500
Newsgroups gmane.comp.lang.perl.code-review-ladder
Message-ID <[email protected]>
--5dNcufZ4prhark0F
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Struan Donald <struan at exo.org.uk> [2003-11-14 17:01]:
> Any thoughts/improvements/whatever on the attached?

One thing that struck me from the example was that when you create a
validator object and use it to validate a page, the validator remembers
the state of the validated page.  In other words, once you use $v to
validate a page, you can't validate another page and not lose the state
of previous validations.  I would prefer to use something like this more
as a factory that produces ValidatedURI instances (or whatever), which
can then be queried separately:

  my $validator =3D WebService::Validator::HTML::W3C->new;
  my $response =3D $validator->validate("http://www.example.com/");

  if ($response->is_valid) {
      printf "%s validated OK\n", $response->uri;
  }
  else {
      print "No love from the validator:\n";
      for my $error ($reponse->errors) {
          print "\t$error\n";
      }
  }

Or even:

  my @responses =3D $validator->validate(@uris);

(darren)

--=20
Although I can accept talking scarecrows, lions, and great
wizards of emerald cities, I find it hard to believe there
is no paperwork involved when your house lands on a witch.

--5dNcufZ4prhark0F
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/tRu3zsinjrVhZaoRAumfAJ44n+0wWjnj9lsFNJN7FAUSwfsr0wCfQmXR
mP9x7h7mHqtQL6JpXpgM1Pc=
=7zCc
-----END PGP SIGNATURE-----

--5dNcufZ4prhark0F--