#!/usr/bin/perl -w
use HTML::ElementTable;
use HTML::AsSubs;
use POSIX qw(ceil);
print "Content-type:text/html\n\n";
print "
Build Table.pl\n";
print "\n";
$total_cells = 517;
$display_cells = $total_cells / 15;
$row_count = 10;
$col_count = ceil($display_cells / $row_count);
$table = HTML::ElementTable->new(maxrow => $row_count-1,
maxcol => $col_count-1);
$table->attr('cellpadding' => 4);
$table->attr('border' => 1);
$table->blank_fill(1);
# counters
$row_inc = 1;
$col_label = 1;
$nav_count = 15;
$nav_inc = 15;
for my $r (0 .. $row_count-1) {
for my $c (0 .. $col_count-1) {
$table->cell($r,$c)->push_content(
a({href => "mypage.html?nav=$nav_count"}, $col_label))
if $nav_count < $total_cells;
$col_label+=10;
$nav_count+=150;
}
$row_inc++;
$col_label = $row_inc;
$nav_inc+=15;
$nav_count = $nav_inc;
}
# Here you could tweak the cells of $table
print $table->as_HTML;
print "\n";