I am reading a dbase file using the XBase.pm module sequentially in order to pick out a few items I want to be placed into a table of available items and published on the web. The dbase file is Approach based with an adx index which XBase cannot handle, yet. Aprox. 8000 records, this bit of code takes 56 seconds to complete running on the web server itself. As I say, the index is not available to speed up the reading by being selective.
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";

In reply to Need to speed up read of dbase file to html page by arw01

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.