We have a fairly standard web development set-up with dev, QA, and prod environments. To smoothly deal with migration through these environments, we've developed a configuration module that has various smarts in it to return the correct data depending on where you are. In dev, file locations, paths, URLs, database info, etc. are based on your individual sandbox settings. In QA, all of these things point to the right places on our QA boxes; likewise with prod.

This all works quite well for us for most config info. However, we've run into a strange situation with mod_perl. If you load config data just once per process, it works fine for pseudo-static information like machine environment and path info. But information that changes per-hit such as the current user (REMOTE_USER) needs to be loaded each time.

From a design perspective, where should that information live and how should it be loaded? Should we 'new' our config module on each hit and include per-hit data there (and re-run all the code), or should a config module contain only data that doesn't change once the process if fired up? Or should we have two modules?

Thanks for any insight.

Update: Did some research based on badaiaqrandista's response and found some information on scope in web apps that gives more detail.


In reply to What config info belongs where for web apps? by cbrandtbuffalo

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.