/[pxelator]/lib/PXElator/html.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/html.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 171 by dpavlin, Thu Aug 6 18:09:30 2009 UTC revision 172 by dpavlin, Thu Aug 6 22:27:34 2009 UTC
# Line 2  package html; Line 2  package html;
2    
3  sub table {  sub table {
4          my $cols = shift;          my $cols = shift;
5            my $th;
6    
7            if ( $cols < 0 ) {
8                    $cols = abs($cols);
9                    $th .= qq|<th>| . shift(@_) . qq|</td>| foreach ( 1 .. $cols );
10                    $th .= qq|</tr>\n<tr>|;
11            }
12    
13          my @td = map { "<td>$_</td>" } @_;          my @td = map { "<td>$_</td>" } @_;
14          my $html = qq{<table>\n<tr>};          my $html = qq{<table>\n<tr>$th};
15          foreach ( 0 .. $#td ) {          foreach ( 0 .. $#td ) {
16                          $html .= $td[$_];                          $html .= $td[$_];
17                          $html .= qq{</tr>\n<tr>} if $_ % $cols == 1;                          $html .= qq{</tr>\n<tr>} if ( $_ + 1 ) % $cols == 0;
18          }          }
19          $html .= qq{</tr>\n</table>};          $html .= qq{</tr>\n</table>};
20  }  }

Legend:
Removed from v.171  
changed lines
  Added in v.172

  ViewVC Help
Powered by ViewVC 1.1.26