in reply to CGI.pm HTML-Generation Methods Considered Useful
$html .= $q->table( { -bgcolor => '#ffffff', -border => 1 }, $q->caption('Status Summary'), # beware beautiful nested maps ahead $q->Tr( [ map { my $k = $_; $q->td( [ $k, map { $data->{$k}{$_} } sort keys %{ $data->{$k} } ] ) } sort keys %{ $data } ] ) );
I fail to see how this is preferable to the normal way of doing it:
$html .= "<table class=\"foo\"><thead><tr>" . (join "\n", map {"<th>$_</th>"} @field) . "</tr></thead><tbody>\n" . (join "\n", map { my %record = %$_; "<tr class=\"".(somecondition($_))."\">" .(join "\n", map {"<td>$record{$_}</td>"} @field)."</tr>" } @record) . "</tbody></table>\n";
|
|---|