package CGI::tab; require Exporter; our @ISA = ("Exporter"); my @tabs; my $posn = 0; sub start_tabs { my $sum = 0; for (@_) { push @tabs, ($_ - $sum); $sum += $tabs[$#tabs]; } my $output = '<table cellpadding=0 cellspacing=0 border=0><tr heig +ht=0>'; $output .= "<td width=$_></td>" for @tabs; $output .= '<td></td></tr><tr><td>'; return $output; } sub t { if ($posn == @tabs) { $posn = 0; return '</td></tr><tr><td>'; } else { $posn ++; return '</td><td>'; } } sub r { my $colspan = @tabs - $posn; $posn = 0; if ($colspan) { return "</td><td colspan=$colspan></td></tr><tr><td>"; } else { return '</td></tr><tr><td>'; } } sub end_tabs { my $colspan = @tabs - $posn; undef @tabs; $posn = 0; if ($colspan) { return "</td><td colspan=$colspan></td></tr></table>"; } else { return '</td></tr></table>'; } } our @EXPORT = qw/start_tabs t r end_tabs/; 1;
In reply to virtual tabbing module for CGI by George_Sherston
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |