Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
PerlMonks and W3C

by dooberwah (Pilgrim)
on Apr 08, 2002 at 22:06 UTC ( #157580=perlquestion: print w/ replies, xml ) Need Help??
dooberwah has asked for the wisdom of the Perl Monks concerning the following question:

Hello all,

I want my scripts to conform to the W3C (World Wide Web Consortium) rules for pages, but pages generated by don't pass cleanly through the W3C validation script. doesn't even print out a valid header to determine what type of document it is. Are there any different modules that print out W3C-friendly HTML? Thanks.

-Ben Jacobs (dooberwah)
"one thing i can tell you is you got to be free"

Comment on and W3C
Replies are listed 'Best First'.
Re: and W3C
by cjf (Parson) on Apr 08, 2002 at 22:31 UTC

    What version of are you using? Last I heard the more recent versions print out valid XHTML (I prefer templating systems and don't use it to print HTML often, so I could be mistaken).

    You also have to do a print $q->header('text/html'); or the like to print a header. See the docs for more detail.

Re: and W3C
by gav^ (Curate) on Apr 08, 2002 at 22:09 UTC
    Don't use then, there are better ways to generate HTML (hint templates).


      I need the functions as well so I can get input from forms. I suppose I could have a script to do the outputting (w/ templates) and a script to read the input (w/ How does this solution hold up in the real world?

      -Ben Jacobs (dooberwah)
      "one thing i can tell you is you got to be free"

        There is no harm at all in using just to read the input... since it's self-loading, the HTML functions only get loaded if you use them, so there's little penalty in using both CGI and templates in the same script.

        Check out the Template Toolkit for a very flexible templating system.


Re: and W3C
by Zaxo (Archbishop) on Apr 09, 2002 at 15:02 UTC


    $ perl -MCGI=:standard -e 'print header(),start_html("Foo Page"),$/' Content-Type: text/html; charset=ISO-8859-1 <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" SYSTEM ""> <html xmlns="" lang="en-US"><head><title>F +oo Page</title> </head><body>
    That seems ok to me. Version 2.8, but it's been like that for a while.

    After Compline,

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://157580]
Approved by jryan
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2015-11-25 22:49 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (692 votes), past polls