in reply to Meditations On HTML In Perl

Well, I hate to rain on your parade, but I disagree.

I just finished a web application for managing a live and silent auction event, completed with ticketing ahead of time, live item list, and invoicing. Apart from a <div align="center"> that I had to stick in a few of the CGIs, I did the whole thing with use CGI and CSS, and I was very happy with the result.

I would have been happy if I'd been able to stay away from HTML completely, but for me it worked out fine. (Doing a table with CGI is a piece of cake compare to the alternative .. especially escaping all those double quotes (ugh) or using a Here Doc (ugh ugh).)

--t. alex
but my friends call me T.

Replies are listed 'Best First'.
Re: Meditations On HTML In Perl
by Ionizor (Pilgrim) on Dec 05, 2002 at 01:38 UTC

    I would agree that escaping double quotes in HTML sucks. Instead I usually use qq with parentheses or braces.

    e.g. print qq(<p>A link to the <a href="test.html">test page</a></p>);

      With the caveat, of course, that JavaScript will break horribly unless you escape your brackets. That brings us back to the original problem or forces us to use a different delimiter.

        But you can put your JavaScript in a separate file and just refer to it. Of course, that hasn't worked for me when I needed it to, so I had to use a HereDoc to get it to work. Ugh.

        --t. alex
        but my friends call me T.
Re: Re: Meditations On HTML In Perl
by BUU (Prior) on Dec 05, 2002 at 02:31 UTC
    What the hell is wrong with using single quotes for html attributes? come on people. Ok, it isn't *quite* valid XHTML/XML, (which i think is stupid..), and if your html is completely valid aside from little errors saying "single quote should be double quote" Then i think you've fufilled everything that xhtml was designed for in the first place. And doing print "<a href='$foo' style='foo:baz' onClick='stuff'>$xxx</a>" is infintely cleaner then doing print "<a href=\\"$foo\\" style=\\"foo:baz\\" onClick=\\"stuff\\">$xxx</a>"..
      What the hell is wrong with using single quotes for html attributes?

      Because standards are useful only when they're... well... standard :-)

      And doing print "<a href='$foo' style='foo:baz' onClick='stuff'>$xxx</a>" is infintely cleaner then doing print "<a href=\\"$foo\\" style=\\"foo:baz\\" onClick=\\"stuff\\">$xxx</a>"..

      This is what qq is there for.

      qq!<a href="$foo" style="foo:baz" onClick="stuff">$xxx</a>!
        What the hell is wrong with using single quotes for html attributes? come on people. Ok, it isn't *quite* valid XHTML/XML, (which i think is stupid..)

      Well, at the risk of sounding like a stand-up comedian, there's three kinds of people in this world, those who can count, and those who can't .. rimshot

      Thank you, thank you, I'll be here all week, be sure to tip your waitresses, try the veal .. rimshot

      But seriously .. that kind of cavalier approach to standards is a kind of 'black and white' thing for me. Either you conform to the standard or you don't.

      Me, I love it when the HTML Validator tells me a page that I've programmed comes out squeaky clean. But then, back in the 80's I was a C developer who wasn't happy until my code was properly indented, and also compiled and linted cleanly. That's just my style.

      Your style sounds more like 'patch it up, close enough' to me. This is not a personal attack -- I don't know you, so it couldn't be -- it's just an observation that you and I appear to have differing standards in quality.

      --t. alex
      but my friends call me T.
      Tolerance for that "hey, it's close enough now ain't it" attitude is the reason the web is nowadays comprised by 99% invalid HTML, which requires parsers be written with extra intelligence and makes it hard to programmatically extract information from remote pages. Not every kind of laziness is a virtue.

      Makeshifts last the longest.