arw01 has asked for the wisdom of the Perl Monks concerning the following question:
my $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime; print "starting $now_string\n"; # ************* Open the files, read the entire database, write the HT +ML file open OUTFILENAME, ">$outfilename" or die "Cannot open $outfilename for + write :$!"; #open file # or report why we cannot open + the file print OUTFILENAME "<HTML><HEAD><META HTTP-EQUIV = 'Pragma' CONTENT='no +-cache'> <TITLE>UTS Available for Sale</title></HEAD><BODY><CENTER><H +1>UTS Trucks Available for Sale</h1> generated $now_string</center +><HR>\n"; print OUTFILENAME "<TABLE BORDER=0><TR><TD>Unit</td><td>Model</td><td> +Make</td><td>Year</td>"; print OUTFILENAME "<td>Spec</td><td>Engine/HP</td><td>Trans</td><td>Re +ar Axle / Ratio / Susp.</td><TD>Miles</td><TD>WB</td>"; print OUTFILENAME "<TD>Color</td><TD>Vin</td><TD>Location</td><TD>Cust +/Desc</td><td>Price</td></TR>\n"; my $table = new XBase '/mnt/fdrive/UNITS.dbf' or die XBase->errstr; print "File $dbasefiletoread ",$outfilename," opened successfully\n"; for (0 .. $table->last_record) { # print "inside loop\n"; #print "$dropit\n"; my @data = $table->get_record($_); if ($data[22] && $data[91] eq "UTS" && $data[95] eq "WPI" && ! +$data[0]) { no warnings 'uninitialized'; print OUTFILENAME "<TR><TD><a href=\"specs/",$data[55] +,".html\">$data[55]</a>","</TD><TD>",$data[1],"-",$data[26],"</TD><TD +>",$data[2],"</TD><TD>",$data[3]; print OUTFILENAME "</TD><TD>",$data[86],"</TD><TD>",$d +ata[9]," / ",$data[61],"</TD><TD>",$data[21],"</TD><TD>"; print OUTFILENAME $data[15]," / ",$data[17],"</TD><TD> +",$data[81],"</TD><TD>",$data[16],"</TD><TD>"; print OUTFILENAME $data[20],"</TD><TD>",$data[94],"</t +d><TD>",$data[64],"</td><TD>",$data[89],"</td>"; print OUTFILENAME "<td>",$data[37],"</td></TR>\n"; } } print OUTFILENAME "</TABLE></BODY>\n"; close OUTFILENAME; print "File $outfilename written successfully\n"; $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime; print "finished $now_string\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need to speed up read of dbase file to html page
by Joost (Canon) on May 31, 2002 at 14:41 UTC |