Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: use CGI or die;

by davorg (Chancellor)
on Jan 11, 2001 at 18:30 UTC ( [id://51120]=note: print w/replies, xml ) Need Help??


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

Replies are listed 'Best First'.
Re: Re: Re: use CGI or die;
by extremely (Priest) on Jan 11, 2001 at 20:20 UTC
    Headings aren't in there to give you a convenient containter for random style markup. Headings are in the the HTML standard to allow you to break a document up into sections in an orderly fashion. People just abuse them to get nice giant bold text. If you want Nice Giant Bold Text and the text isn't a series of headers, please do use font or css on a <span> tag. H1-H6 tags should be used for headings so that they can be pulled into an outline of a document. Otherwise you just have found another way to abuse HTML.

    --
    $you = new YOU;
    honk() if $you->love(perl)

      While I certainly agree in principle, there's a small problem with that point, in practice (sometimes): Many browsers do not properly parse the span tag and, worse, do an abominable job of applying CSS to the same tag. There are times when the only options are using the heading tags or using the font tags to get the desired effects in a broad enough cross-section of graphical browsers to make a webpage properly functional to a large enough segment of the browsing population.

      Since using font tags has a tendency to generate error warnings in CSS validators, that means that sometimes heading tags are the only option for getting by the validators. That, of course, is because validation scripts are often somewhat limited, and not because the code is actually valid, but it emphasizes the difficulty we'll have in moving toward a standards-compliant web while standards-noncompliant browsers like IE still command such a large share of web browsing business.

      I agree: heading tags shouldn't be used that way. That doesn't mean I don't understand why they often are. I'm more annoyed by the failure of browsers to properly parse span tags than I am by the failure of web designers to properly use HTML (or XHTML, as the case may be) and CSS when they try to compensate for the failures of web browsers.

      I eagerly await the day that the tools with the best functionality all properly support XHTML, in any case. I'd like to see CGI.pm and any other tool used for generating markup actually produce code that is difficult to structure badly by virtue of its parsing rules. Regardless of what it does support, however, until the viewing apparatus supports the full standard there will always be standards-noncompliant kludges used to get around the failings in the system as a whole.

      - apotheon
      CopyWrite Chad Perrin
Re: use CGI or die;
by jonadab (Parson) on Jan 27, 2003 at 13:39 UTC
    > The only option is for browsers to suddenly stop
    > working on invalid X?HTML, but the chances of that
    > happening are appoximately zero.

    Suddenly? No. Most of the web is still a non-wellformed mixture of HTML3, HTML4, and imaginary tags made up by specific browsers. However, current browsers do choke on non-wellformed markup if it is served with a content-type of text/xml, and that's a first step. As things like XSLT and RDF start to catch on, sites that want to harness the value of those things will have to be redone in wellformed XML, and that's that. (They won't necessarily have to provide and validate against Schemata, but we have to start someplace.)

    Incidentally, if CGI.pm is now improved to the point of being capable of producing anything that remotely resembles XHTML, maybe I should have another look at it; I've been avoiding it because of two things, and one was the execrable state of its output. If that has been shaped up, maybe the other thing (the tendency to obfuscate the Perl code) has been improved too, since I looked at it (which has been a bit), and I should have a second look.

     --jonadab

      Using CGI to handle the logistics of server interaction and using it to produce your output are two very different things. I use it nearly exclusively for the former but almost never for the latter.

      Makeshifts last the longest.

        Good point but what do you use then to generate output ? Hand cut code, a module that does a more reasonable job than CGI or a full blown framework (in which case does it not parse the CGI for you anyway)? I realise this node is a little old so perhaps everyone has moved on to Maypole or similar by now but I am currently building my first web interface in a few years so I am browsing around for clues.

        Cheers,
        R.

        Pereant, qui ante nos nostra dixerunt!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://51120]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-03-19 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found