File: web.pl

package info (click to toggle)
lg-issue31 4-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 4,436 kB
  • ctags: 103
  • sloc: makefile: 37; perl: 31; sh: 4
file content (45 lines) | stat: -rw-r--r-- 962 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl

# Import modules of interst.
use CGI qw/:standard :html3 :netscape/;
use Msql;

# print out the HTML HEAD section
print header,
   start_html(
      -author=>'webmaster@graphics-muse.org',
      -title=>'My Little Tools',
      -bgcolor=>'#FFFFFF', -text=>'#000000'
   );

# Open the Msql connections and select the databases of interest.
my $dbh1 = Msql->connect();
$dbh1->selectdb('tools');

my $sth = $dbh1->query("SELECT * from tools");
my @rows;
my @result;
while (@result = $sth->fetchrow)
{
   push( @rows, td({-align=>'CENTER', -valign=>'CENTER'}, $result[1]));
}
my $tools_list =
      table( {-border=>1, -cellpadding=>'1', -cellspacing=>'5'},
           Tr(@rows)
      );

# Now print the complete table
print
   center(
   table(
      {-border=>1, -width=>'100%', -cellpadding=>1, -cellspacing=>5},

      Tr(
         td({-align=>'CENTER', -valign=>'CENTER'}, $tools_list),
      )
   )
);


# End of HTML output.
print end_html;