in reply to XHTML Strict?

It would be nice to know what exactly fails with CGI and XHTML Strict? You can also send a bug report about it.

If you are concerned about staying in the XHTML Strict spec, you can gain control of the output (without HEREDOCS) by going to a templating system. This also gains you the advantages of removing your presentation from your program logic, shortening your code, reuse of your XHTML, and overall easier maintainence.

You can choose from several excellent Templating Systems.

  • Template Toolkit
  • Mason
  • HTML::Template


  • grep
    Mynd you, mønk bites Kan be pretti nasti...

    Replies are listed 'Best First'.
    Re: Re: XHTML Strict?
    by peschkaj (Pilgrim) on Nov 04, 2002 at 04:28 UTC
      The Doctype is incorrect. CGI produces the XHTML-Basic Doctype, however it also places a lang attribute in the html tag, thus invalidating the XHTML-Basic doctype.

      I would prefer to not have to install more modules on the system that I am on. I'm using HP-UX at work and every module that I need to install requires writing up a change request form and scheduling a migration date so that I can get a hold of root to do my installs.

      If you make something idiot-proof, eventually someone will make a better idiot.
      I am that better idiot.

        Which version of CGI.pm do you have? With the latest version (2.89), I get this:

        $ perl -MCGI=:standard -le 'print header, start_html' Content-Type: text/html; charset=ISO-8859-1 <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"><head><title>Untitled Document</title> </head><body>

        which looks right to me.

        The list of changes includes this:

        Version 2.81

        1. Removed extraneous slash from end of stylesheet tags generated by start_html in non-XHTML mode.
        2. Changed behavior of CGI::Carp with respect to eval{} contexts so that output behaves properly in mod_perl environments.
        3. Fixed default DTD so that it validates with W3C validator.
        --
        <http://www.dave.org.uk>

        "The first rule of Perl club is you do not talk about Perl club."
        -- Chip Salzenberg

          Greetings Monks,
          While this thread is a bit dated, I'm trying to figure out how I might choose which version of XHTML get's produced. I've read (and searched), and experimented for quite some time. But haven't found the magic. As it is, I'm provided with Transitional. I have no reason not to choose Strict, except I don't know how. <sheepish grin>

          For the record:
          $CGI::VERSION='3.48';

          Thank you for all your time and consideration.

          EDIT:
          OK, I did a little more digging in my copy of CGI.pm, and found my own answer. Seems version 3.48 simply commented out XHTML Basic 1.0, and pasted in XHTML 1.0 Transitional, but that's it - as far as the "upgrade" goes.

          Solution:
          I simply commented XHTML 1.0 Transitional, and pasted my own upgrade in. :)
          Maybe v.3.49 will provide a "Strict" option. Till then, I'll live with my HACK.

          --
          use qw(:perl:always);
          use qw(:perlmonks:daily);
          It's realy old post, but I foun it now. "XHTML Strict" and "XHTML Transitional" DO NOT mean the same.

        there's nothing stopping you from installing modules yourself. you just can't put them in the main library.

        tar zxvf SomeModule.tar.gz cd SomeModule perl Makefile.PL PREFIX=/some/directory/you/can/write/to make make install
        and then, in your code:
        use lib qw(/some/directory/you/can/write/to); use Some::Module;

        anyway, having HTML::Template or Template::Toolkit installed are probably well worth whatever paperwork you have to go through.

        anders pearson

        If it really bothers you, you can always modify CGI.pm's source code. :)