jcfox has asked for the wisdom of the Perl Monks concerning the following question:

I am looking into doing simple HTML validition. I have found HTML::Validator on cpan, but I cannot use because we do not have lib-sgml installed on the boxes this will run on. We do have nsgml, and I like how it works. My question is this: other than HTML::Validator (unless there is a way to install it without lib-sgml) is there a standard perl way to validate HTML? Something that has been used and tested over the perl ages?

Replies are listed 'Best First'.
Re: HTML Validation
by zwon (Abbot) on Jan 27, 2009 at 21:43 UTC

    But HTML::Validator actually uses nsgml. SGML library contains DTDs, you need them in any case, you can install it in any location, so it shouldn't be a problem.

    Update: note, that sgml-library is not something you should compile and execute, it just text (SGML, XML, DTD) documents.

    Update2: there are also other modules that may be interesting for you: HTML::Lint and HTML::Tidy. Tidy requires libtidy, so maybe this is not your choice, and Lint is a pure perl module.

Re: HTML Validation
by ww (Archbishop) on Jan 27, 2009 at 23:18 UTC

      Better still

      Write a Perl script that also corrects those errors!

      I remember well the first time I used the W3C validator it returned 400 errors from a single XHTML page!