As others said, if most of your pages will have dynamic content, look into frameworks. To answer your first questions, it varies. Some people have a single CGI that runs everything, calling functions in other files depending on the pathinfo (the way PHP apps like Wordpress or Drupal run everything through index.php). Others use multiple CGIs, each for a different function. Others use SSI, which allows you to embed Perl scripts (or other executables) in HTML, but in a pretty inflexible way, so that's not common. But look at frameworks.

As for your last requirement: if you want a portion of a page updated regularly without refreshing the whole page, you'll want to look at client-side solutions like Ajax. You can push updates from the server side with Apache's nph-script method, but I've always thought that's pretty ugly. You can also send HTTP headers or meta tags that will cause automatic refreshes, but then you're refreshing the whole page, which you said you don't want. (Those might work within an iframe to do part of a page; I'm not sure about that.) But sites that do dynamic updates to individual divs on the fly use Ajax or something similar, to fetch new content and change just what elements need to be changed. I think all the common frameworks come with a fair amount of support for Ajax built in, too.


In reply to Re: CGI layout by aaron_baugher
in thread CGI layout by marlin

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.