J
Justin C
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.
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.