--- Carl Franks <[EMAIL PROTECTED]> wrote:
> > I could of swore I saw a message about some Perl module that outputs
> > "pretty", properly indented HTML. I can't find the message in my email
> > client, so if anyone could help me, I'd be very grateful.
> >
> the module CGI::Pretty
> goto cpan.org if you don't have it installed.
> you can test if it's installed by running the following program.
> (code below)
>
>
> #!/usr/bin/perl -wT
> use strict;
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
> use CGI::Pretty;
>
> my $q = new CGI;
> print $q->header;
> print "CGI::Pretty is installed!";
> exit
A couple of comments about this.
1. CGI::Pretty is a subclass of CGI, so you don't need the "use CGI" line in there.
$ perl -MCGI::Pretty=:standard -e 'print param("name")' name=Ovid
Ovid
2. CGI::Pretty only works with the HTML generating features of CGI.pm. If you don't
use those,
get no benefit.
Compare this:
$ perl -e 'print q|<head><body><h1>test</h1></body></head>|'
<head><body><h1>test</h1></body></head>
To this:
$ perl -MCGI::Pretty=:standard -e 'print start_html,table(Tr(td("Hi
there"))),end_html'
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"><head><title>Untitled
Document</title>
</head><body>
<table>
<tr>
<td>
Hi there
</td>
</tr>
</table>
</body></html>
Cheers,
Curtis "Ovid" Poe
=====
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A
__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]