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.