--- lib/PXElator/html.pm 2009/08/06 18:09:30 161 +++ lib/PXElator/html.pm 2009/08/06 22:27:34 172 @@ -2,11 +2,19 @@ sub table { my $cols = shift; + my $th; + + if ( $cols < 0 ) { + $cols = abs($cols); + $th .= qq|| . shift(@_) . qq|| foreach ( 1 .. $cols ); + $th .= qq|\n|; + } + my @td = map { "$_" } @_; - my $html = qq{\n}; + my $html = qq{
\n$th}; foreach ( 0 .. $#td ) { $html .= $td[$_]; - $html .= qq{\n} if $_ % $cols == 1; + $html .= qq{\n} if ( $_ + 1 ) % $cols == 0; } $html .= qq{\n
}; }