CGI::Pretty breaking w3c validation

P

pdpi

I have a curious problem.

I'm using the following code to create a validation link for the XHTML
I'm generating:

print $cgi->a({href=>'http://validator.w3.org/check?uri=referer'},
$cgi->img({src=>'http://www.w3.org/Icons/valid-xhtml10',
alt=>'Valid XHTML 1.0 Strict', height=>31,
width=>88}));

which works all nice and fine, and the XHTML passes with flying
colours.

Except that the XHTML CGI.pm generates is pretty unreadable, so figured
adding a little

use CGI::pretty;

to it would be grand. But if I put that there, all of a sudden the
<img> tag on that anchor there stops having a proper closing tag.
Or, more accurately, instead of <img stuff=here />, the program now
outputs <img stuff=here >, thus not closing the tag. Can anyone help?
The documentation of CGI::pretty sure didn't, and googling clpmisc for
CGI::pretty validation,
CGI::pretty problems
and other variations didn't give any hints.
 
G

Gunnar Hjalmarsson

pdpi said:
I have a curious problem.

I'm using the following code to create a validation link for the XHTML
I'm generating:

print $cgi->a({href=>'http://validator.w3.org/check?uri=referer'},
$cgi->img({src=>'http://www.w3.org/Icons/valid-xhtml10',
alt=>'Valid XHTML 1.0 Strict', height=>31,
width=>88}));

which works all nice and fine, and the XHTML passes with flying
colours.

Except that the XHTML CGI.pm generates is pretty unreadable, so figured
adding a little

use CGI::pretty;

to it would be grand. But if I put that there, all of a sudden the
<img> tag on that anchor there stops having a proper closing tag.
Or, more accurately, instead of <img stuff=here />, the program now
outputs <img stuff=here >, thus not closing the tag. Can anyone help?
The documentation of CGI::pretty sure didn't, and googling clpmisc for
CGI::pretty validation,
CGI::pretty problems
and other variations didn't give any hints.

Your problem is indeed curious.

You know what output you want. Why are you struggling with not only one,
but two modules to generate the output instead of just typing it?
 
J

John Bokma

Gunnar Hjalmarsson said:
You know what output you want. Why are you struggling with not only one,
but two modules to generate the output instead of just typing it?

Moreover: what's the point of a valid XHTML button (I skip all the possible
issues with using XHTML instead of HTML 4.01 strict). People who care about
such things can validate your site by themselves. And how many people do
care?
 
P

pdpi

because never in my programming life had I encountered incompatibility
problems between two modules of a given language. And all prior
evidence just pointed towards CGI::pretty being a pretty innocent thing
to include. And lastly because I'd rather use a consistent style across
the code if at all possible (and practical), so mixing explicit and
CGI.pm-generated html is something I'd rather avoid. And finally
because I'm a greedy bastard that enjoys gobbing as much information as
possible all at once.

John said:
Moreover: what's the point of a valid XHTML button (I skip all the possible
issues with using XHTML instead of HTML 4.01 strict). People who care about
such things can validate your site by themselves. And how many people do
care?

well, regarding the XHTML vs HTML argument, CGI.pm generated XHTML 1.0
Basic until I told it to make it strict. I figured XHTML would be as
reasonable as HTML. And /someone/ must break the path. IE shows it
right, so does firefox. When I get to my university tomorrow I'll check
Konqueror. If the three arguably biggest rendering engines all deal
with it nicely, AND it is standardized, everybody else can get a decent
browser (and I do feel I have moral high-ground). Besides, this is a
learning experience sort of thing, so I'm not (yet) much concerned with
anyone else having problems with it being xhtml.

HOWEVER, I do care for proper respect for standards. And I'd like to
make people care. I might get people who don't yet care about that to
visit. And that button stands out a bit. An explanation /somewhere/ of
what it means, and voi la, some promotion for something I believe in.
Also, for the people that care, a mere glance lets them know that I,
too, care.
Plus, I also believe in making things simple for everybody.
 
J

John Bokma

pdpi said:
because never in my programming life had I encountered incompatibility
problems between two modules of a given language.

Uhm, a very short programming life then :-D.
well, regarding the XHTML vs HTML argument, CGI.pm generated XHTML 1.0
Basic until I told it to make it strict.

Yes, I consider that a design flaw in CGI.pm. Has been discussed a lot
here, is not going to change (sadly).
I figured XHTML would be as
reasonable as HTML.

<http://codinginparadise.org/weblog/2005/08/xhtml-considered-
harmful.html>
And /someone/ must break the path.

What does XHTML add over HTML 4.01 strict?
IE shows it
right, so does firefox.

That doesn't say much, really. I can hack up a page that is really badly
coded in HTML and both IE and Firefox will show it right, doesn't make
it right.
When I get to my university tomorrow I'll
check Konqueror. If the three arguably biggest rendering engines all
deal with it nicely, AND it is standardized,

XHTML is not a standard. ISO HTML is (but has other issues).
everybody else can get a
decent browser (and I do feel I have moral high-ground). Besides, this
is a learning experience sort of thing, so I'm not (yet) much
concerned with anyone else having problems with it being xhtml.

But I guess you also want to learn why you probably should not use
XHTML.
HOWEVER, I do care for proper respect for standards.

Then you have to switch to ISO HTML.
And I'd like to
make people care. I might get people who don't yet care about that to
visit. And that button stands out a bit.

Like I said: people who care if your page is valid, know how to validate
it. The rest (majority) doesn't care.
An explanation /somewhere/ of
what it means, and voi la, some promotion for something I believe in.

But you can't explain why XHTML is better, or maybe not...
Also, for the people that care, a mere glance lets them know that I,
too, care.

But your cause might be a wrong one. Why do "we" need XHTML?
Plus, I also believe in making things simple for everybody.

I think that would mean removing the XML validation button thingy :-D.
 
A

axel

Moreover: what's the point of a valid XHTML button (I skip all the possible
issues with using XHTML instead of HTML 4.01 strict). People who care about
such things can validate your site by themselves. And how many people do
care?

I thought about this... maybe two reasons... (i) that if the link is correctly
set up, a validation report can be made for the author very easily; (ii) if
he is looking for a job, then prospective employers can see and check his code.

I have such tags on my website for reason i.

Axel
 
G

Gunnar Hjalmarsson

pdpi said:
because I'd rather use a consistent style across
the code if at all possible (and practical), so mixing explicit and
CGI.pm-generated html is something I'd rather avoid.

Okay... I have to admit that I usually don't use CGI.pm to genererate
HTML in the first place. :)
 
J

John Bokma

I thought about this... maybe two reasons... (i) that if the link is
correctly set up, a validation report can be made for the author very
easily; (ii) if he is looking for a job, then prospective employers
can see and check his code.

I have such tags on my website for reason i.

I don't need (i) because as a "lazy" programmer I have a script that makes
it even easier.

(ii) I doubt that they need a button, I mean, then I can add a bunch more:

Site made with [XML] in [TextPad], converted to valid [HTML 4.01 strict],
using [Perl] and [XML::Twig] downloaded from [CPAN]. Graphics made with
[CorelXara].. etc.

On a page itself, ok, but not as a footer on every page :-D.
 
A

A. Sinan Unur

I don't need (i) because as a "lazy" programmer I have a script that
makes it even easier.

Hmmm ... I would have thought the ultimate act of laziness would be to
install the web developer extension for Firefox.

Sinan
 
J

John Bokma

A. Sinan Unur said:
Hmmm ... I would have thought the ultimate act of laziness would be to
install the web developer extension for Firefox.

Nah, I run my own script which walks over all my HTML files, and validates
them, and only complains when it finds a bad page. Since I generate my
pages from XML I often trust into that process, and don't validate often.
 
P

pdpi

OK, time for a mass answer.

John said:
Uhm, a very short programming life then :-D.

Well, 10 years and counting. But I haven't stuck to any one language
long enough for that sort of stuff to crop up. Except with Mathematica
(which I've been using extensively for a certain and very restricted
sort of programming for the last 4 years), which seems mostly immune to
it.


well, those chaps make some interesting points.
What does XHTML add over HTML 4.01 strict?

Good question. <?xml version="1.0" encoding="utf-8"?> at the begining
springs to mind. Future proofing was what I had in mind. Apparently
ill-foundedly.


XHTML is not a standard. ISO HTML is (but has other issues).

OK, that's a very important point. Care to point me towards some
article on the subject?
But I guess you also want to learn why you probably should not use
XHTML.

you had me at "XHTML is not a standard" :)
Then you have to switch to ISO HTML.

see above.

(this one is out of order, but makes replying simpler)
That doesn't say much, really. I can hack up a page that is really badly
coded in HTML and both IE and Firefox will show it right, doesn't make
it right.

Well, I was working under the assumption XHTML was a proper,
independently recognized, standard. My comment regarding IE and Firefox
rendering it just fine leaned heavily on that. IE still has 85%+ of the
market, yet you won't find me using IE-only stuff that (obviously)
renders just right there.

But you can't explain why XHTML is better, or maybe not...

No I can't, not really. Seems the buzzword monster had me for a while.
I think that would mean removing the XML validation button thingy :-D.


Nah. It'll just be HTML 4.01 instead by sometime tomorrow :p

Gunnar said:
Okay... I have to admit that I usually don't use CGI.pm to genererate
HTML in the first place. :)

Starting to think I shouldn't, either. Makes for really cluttered code.

John said:
I don't need (i) because as a "lazy" programmer I have a script that makes
it even easier.

(ii) I doubt that they need a button, I mean, then I can add a bunch more:

Site made with [XML] in [TextPad], converted to valid [HTML 4.01 strict],
using [Perl] and [XML::Twig] downloaded from [CPAN]. Graphics made with
[CorelXara].. etc.

On a page itself, ok, but not as a footer on every page :-D.

on (i), alter code, refresh browser, middle click the little button.
Seems pretty effective to me. on (ii), that as well.
 
J

John Bokma

pdpi said:
OK, time for a mass answer.



Well, 10 years and counting. But I haven't stuck to any one language
long enough for that sort of stuff to crop up. Except with Mathematica
(which I've been using extensively for a certain and very restricted
sort of programming for the last 4 years), which seems mostly immune
to it.

Well, I often have seen modules not cooperating :) Or dynamically
loaded libraries breaking things :) Recently, I upgraded a Perl module,
and my program fell apart. Still no idea why, I just use the old module
for now.
Good question. <?xml version="1.0" encoding="utf-8"?> at the begining
springs to mind. Future proofing was what I had in mind. Apparently
ill-foundedly.

Don't worry, I know because I once used XHTML on my site because I
thought XHTML had advantages and got a similar reply as I just gave.
OK, that's a very important point. Care to point me towards some
article on the subject?

A common misunderstanding is that w3c makes standards. Technically they
make recommendations, working drafts etc. Standards come from
organizations like ISO, ECMA. ISO has a HTML standard, but it has also
some issues, for me the most important one is that an img element no
longer can have height and width attributes.

The whole standard v.s. recommendations sounds like nitpicking, but if
you ask in a html related group your question might be ignored and a
long winded "not standards" discussion might be the result :-D

[ snip ]
Well, I was working under the assumption XHTML was a proper,
independently recognized, standard. My comment regarding IE and
Firefox rendering it just fine leaned heavily on that. IE still has
85%+ of the market, yet you won't find me using IE-only stuff that
(obviously) renders just right there.

If I recall correctly, some versions of IE have problems with the <?xml
...> header on top. There are work arounds (IIRC), etc. But they are not
nice (again IIRC)
No I can't, not really. Seems the buzzword monster had me for a while.

Don't worry, had me too, and I got a similar reply like I am writing now
:)

Gunnar Hjalmarsson = >>
Starting to think I shouldn't, either. Makes for really cluttered
code.

But otherwise, be aware that CGI.pm defaults to XHTML :)

John Bokma = >>
I don't need (i) because as a "lazy" programmer I have a script that
makes it even easier.

(ii) I doubt that they need a button, I mean, then I can add a bunch
more:

Site made with [XML] in [TextPad], converted to valid [HTML 4.01
strict], using [Perl] and [XML::Twig] downloaded from [CPAN].
Graphics made with [CorelXara].. etc.

On a page itself, ok, but not as a footer on every page :-D.

on (i), alter code, refresh browser, middle click the little button.
Seems pretty effective to me.

type v tab return and have another cup of coffee works for me :) Note
that I generate my pages from XML, so I am most of the time quite sure
that the output is valid.
 
M

Matt Silberstein


I just took a look at that and I have to disagree with "3. Custom
attributes are sinful". Custom attributes, at least how he shows them,
are a way of putting data into mark-up. That sure looks to me like a
bad idea, particularly when there is an attempt to separate data from
markup from presentation.

[snip]

--
Matt Silberstein

Do something today about the Darfur Genocide

http://www.beawitness.org
http://www.darfurgenocide.org
http://www.savedarfur.org

"Darfur: A Genocide We can Stop"
 
M

Matt Garrish

John Bokma said:
A common misunderstanding is that w3c makes standards. Technically they
make recommendations, working drafts etc. Standards come from
organizations like ISO, ECMA. ISO has a HTML standard, but it has also
some issues, for me the most important one is that an img element no
longer can have height and width attributes.

Let's put a bullet in ISO-HTML:

<quote https://www.cs.tcd.ie/15445/UG.html#HEAD>
Scripting is not yet considered to be sufficiently stable and mature to be
included in an International Standard, so the <HEAD> [W3C 7.4.1] element
content model does not include the <SCRIPT> [W3C 18.2.1] element.
</quote>

Now there's a half-assed way of making a standard!

Matt
 
J

John Bokma

Matt Garrish said:
John Bokma said:
A common misunderstanding is that w3c makes standards. Technically
they make recommendations, working drafts etc. Standards come from
organizations like ISO, ECMA. ISO has a HTML standard, but it has
also some issues, for me the most important one is that an img
element no longer can have height and width attributes.

Let's put a bullet in ISO-HTML:

<quote https://www.cs.tcd.ie/15445/UG.html#HEAD>
Scripting is not yet considered to be sufficiently stable and mature
to be included in an International Standard, so the <HEAD> [W3C 7.4.1]
element content model does not include the <SCRIPT> [W3C 18.2.1]
element. </quote>

Now there's a half-assed way of making a standard!

Why? There are still differences between JavaScript implementations. Yes,
there is an ECMA standard, which is a subset.

Yesterday I had a peek at Ajax, and the first thing that's needed is
sniffing how to get the XML data...
 
M

Matt Garrish

John Bokma said:
Matt Garrish said:
John Bokma said:
A common misunderstanding is that w3c makes standards. Technically
they make recommendations, working drafts etc. Standards come from
organizations like ISO, ECMA. ISO has a HTML standard, but it has
also some issues, for me the most important one is that an img
element no longer can have height and width attributes.

Let's put a bullet in ISO-HTML:

<quote https://www.cs.tcd.ie/15445/UG.html#HEAD>
Scripting is not yet considered to be sufficiently stable and mature
to be included in an International Standard, so the <HEAD> [W3C 7.4.1]
element content model does not include the <SCRIPT> [W3C 18.2.1]
element. </quote>

Now there's a half-assed way of making a standard!

Why? There are still differences between JavaScript implementations. Yes,
there is an ECMA standard, which is a subset.

What difference does that make? I fail to see how any differences in
javascript invalidate the use of a <script> tag in a header (or anywhere
else). Their job is not to define the scripting language in this spec, but
the tags that can be used.

Maybe you don't understand the full implication of this arbitrary judgement
call, which is that in "ISO-HTML" you cannot include *any* scripting. That
alone invalidates it for everything but the most trivial of sites.

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top