http://qs321.pair.com?node_id=51120


in reply to (ichimunki) re: use CGI or die;
in thread use CGI or die;

The problem is that many years ago it was decided by the powers that be that browsers would be lenient towards bad HTML. This is generally seen as a Bad Thing. As you've seen, the vast majority of the web is now made up of invalid HTML.

Using the HTML shortcuts in CGI.pm helps in one way as a construction like:

ul(li([1 .. 10]));

will at least be well-formed, unfortunately it doesn't prevent you doing something like:

p(font({size=>'larger', color=>'red'}, 'Heading'));

instead of

h1('heading');

and using CSS to handle the appearance.

I haven't looked at a new version of CGI.pm for some time, but I'm hoping that it either has or will soon have an XHTML mode, but that still won't stop people from Doing The Wrong Thing :( You can't get away from the fact that it's the web page author's responsibility to create valid HTML.

The only option is for browsers to suddenly stop working on invalid X?HTML, but the chances of that happening are appoximately zero.

Dave...
(who tries to validate all of his web pages, but admits that a few errors do creep in)

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me