Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > CGI table tidy layout possible?

Reply
Thread Tools

CGI table tidy layout possible?

 
 
Justin C
Guest
Posts: n/a
 
      12-09-2011
Can CGI print tidy html? The below code seems correct as per CGI
documentation but the output is a mess. If there's anything not
displayed right and I have to rummage through the HTML to figure out
what it is, it's not very easy because of the awfully formatted HTML.

Here's my code, my live data is sixty lines so you can imagine how that
HTML looks.

#!/usr/bin/perl
use warnings;
use strict;
use CGI qw/:standard *table/;

my $names;

while (<DATA>) {
chomp;
my ($name, $code) = split /\|/;
$names->{$name} = $code;
}

print header, start_html(), start_table(),
map {
Tr([
td([$_, $names->{$_}])
])
} sort keys %$names;
print end_table();

__DATA__
Paul McCartney|2342
John Lennon|2134
George Harrison|4432
Ringo Starr|9876


Justin.

--
Justin C, by the sea.
 
Reply With Quote
 
 
 
 
Justin C
Guest
Posts: n/a
 
      12-09-2011
On 2011-12-09, Justin C <> wrote:
> Can CGI print tidy html?


Very sorry to have wasted peoples' time. I've found the solution, I
wasn't searching on the correct words. Quoting CGI.pm:

"To get pretty-printed output, please use CGI:retty..."

Justin.

--
Justin C, by the sea.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Layout suggestions - table layout sso Java 6 04-30-2009 05:17 AM
Css-Layout vs Table-Layout Habib HTML 15 06-20-2006 05:11 AM
Choosing Layout: Css-Layout or Table-Layout hpourfard@gmail.com ASP .Net 1 06-19-2006 10:06 AM
Table-based layout to CSS layout Guybrush Threepwood HTML 20 06-11-2006 11:12 AM
CSS Layout question - how to duplicate a table layout with CSS Eric ASP .Net 4 12-24-2004 04:54 PM



Advertisments