/[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

Contents of /lib/PXElator/html.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 161 - (show annotations)
Thu Aug 6 18:09:30 2009 UTC (14 years, 7 months ago) by dpavlin
File size: 815 byte(s)
fix selected option
1 package html;
2
3 sub table {
4 my $cols = shift;
5 my @td = map { "<td>$_</td>" } @_;
6 my $html = qq{<table>\n<tr>};
7 foreach ( 0 .. $#td ) {
8 $html .= $td[$_];
9 $html .= qq{</tr>\n<tr>} if $_ % $cols == 1;
10 }
11 $html .= qq{</tr>\n</table>};
12 }
13
14 sub tabs {
15 return unless @_;
16 my $html = qq{<table border=1>\n<tr>};
17 foreach my $row ( @_ ) {
18 $row =~ s{\t}{</td><td>}g;
19 $html .= qq|<tr><td>$row</td><tr>\n|;
20 }
21 $html .= qq|</table>|;
22 return $html;
23 }
24
25
26 sub tt {
27 qq|<tt>| . join(' ', @_) . qq|</tt>|;
28 }
29
30 sub select {
31 my $name = shift;
32 my $selected_option = shift;
33 return join("\n"
34 , qq|<select type=select name=$name>|
35 , join("\n", map { my $selected = $_ eq $selected_option ? 'selected' : ''; qq|<option name=$_ $selected>$_</option>| } @_ )
36 , qq|</select>|
37 , qq|</form>|
38 );
39 }
40
41 warn "loaded";
42
43 1;

  ViewVC Help
Powered by ViewVC 1.1.26