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 = ''; $output .= "" for @tabs; $output .= '
'; return $output; } sub t { if ($posn == @tabs) { $posn = 0; return '
'; } else { $posn ++; return ''; } } sub r { my $colspan = @tabs - $posn; $posn = 0; if ($colspan) { return "
"; } else { return '
'; } } sub end_tabs { my $colspan = @tabs - $posn; undef @tabs; $posn = 0; if ($colspan) { return "
"; } else { return ''; } } our @EXPORT = qw/start_tabs t r end_tabs/; 1;