3 use Data::Dump qw/dump/;
11 $th .= qq|<th>| . shift(@_) . qq|</td>| foreach ( 1 .. $cols );
12 $th .= qq|</tr>\n<tr>|;
15 my @td = map { "<td>$_</td>" } @_;
16 my $html = qq{<table>\n<tr>$th};
19 foreach ( 0 .. $#td ) {
21 if ( ( $_ + 1 ) % $cols == 0 ) {
22 $zebra = $row++ % 2 == 0 ? qq{ style="background: #eee"} : '';
23 $html .= qq{</tr>\n<tr$zebra>};
26 $html .= qq{</tr>\n</table>};
31 my $html = qq{<table border=1>\n<tr>};
32 foreach my $row ( @_ ) {
33 $row =~ s{\t}{</td><td>}g;
34 $html .= qq|<tr><td>$row</td><tr>\n|;
36 $html .= qq|</table>|;
42 qq|<tt>| . join(' ', @_) . qq|</tt>| if @_;
47 my $selected_option = shift;
48 unshift @_, '' unless $selected_option;
50 , qq|<select type=select name=$name>|
51 , join("\n", map { my $selected = $_ eq $selected_option ? 'selected' : ''; qq|<option name=$_ $selected>$_</option>| } @_ )
58 qq|<pre>| . join(' ', @_) . qq|</pre>| if @_;
63 my $dump = dump( $data );
64 $dump =~ s{"([^"]+)"(\s*=>)}{$1 $2}gs;
65 $dump =~ s{"([^"]*)"}{"<b>$1</b>"}gs;
70 my ($ip,$conf,$format) = @_;
71 my @editable = splice(@_,3);
73 warn "# conf ",dump( $ip, $conf, $format, [ @editable ] );
79 my $html = $conf->{$name};
81 if ( $format eq 'edit' && grep { m/^$name$/ } @editable ) {
82 $size = length($html);
83 ( $name, qq|<input name=$name value="$html" size=$size>| )
85 if ( $name eq 'amt' ) {
86 $html = qq|<a title="$html" href=http://$ip:16992/logon.htm>logon</a>|;
87 } elsif ( $name eq 'ssh' ) {
88 $html =~ s{\s(\S{16}).+(\S{16})\s}{ $1..$2 };
90 $html = qq|<pre style="display: inline">$html</pre>|
92 $html =~ s{\b(\S+)\t(\S+)\t(\S+)\b}{<b title="$1/$2">$3</b> }gs;
94 if ( $format =~ /edit|table/ ) {
97 qq|<em>$name</em> $html<br>|
102 $format eq 'inline' ? join("\n", @opts) : @opts;