Since you mention this is on your main page, it sounds like you are worried a bit about performance. A static page is much faster than a page that requires a DB lookup, however, some web server setups already incur much of the expense of establishing a DB connection so the "cost" might not be so high; it depends on your particular circustances. Let's assume that the choice is between a static page and the full cost of establishing a DB connection and quering the DB for the info.

You can build a semi-static site quite easily. Use HTML::Template (or other templating module) to merge semi-static db data into static .html files. Psuedo code below: (note this does one file, but you could easily do many with this same script )

use HTML::Template my %vars = getStuffFromDB(); # open the html template my $t = HTML::Template->new(filename => 'ffff.tmpl'); $t->param( foo => $var{'foo'}; # open $filehandle to .html file .. snip .. # output print $fh $t->output;

-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday


In reply to Re: Best way of storing semi-static data by freddo411
in thread Best way of storing semi-static data by kiat

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.