#!/usr/bin/perl -wT # viewfiles.cgi use strict; use DBI; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); my $Web_Directory = "/book/storage"; Print_Html_Top(); Get_Descriptions(); Print_Html_Bottom(); sub Print_Row{ my $rec = shift; my $fname = $rec->{FileName}; my $desc = $rec->{Description}; print qq(); print qq($fname); print qq($desc); } sub Get_Descriptions{ my $DBH = DBI->connect("DBI:mysql:book", "book", "addison"); my $sth_fetch = $DBH->prepare( qq(SELECT * FROM files) ) or die $DBH->errstr; $sth_fetch->execute(); while( my $ptr = $sth_fetch->fetchrow_hashref ){ Print_Row($ptr); } } sub Print_Html_Top{ print header; print<File Viewer

File Viewer

EOT } sub Print_Html_Bottom{ print<

Upload File

EOT }