I've recently been doing some work writing web systems that use Perl, CGI, and MySQL to get stuff done. Now, in order to make things easy to install on various sytems, I've included a file(install.cgi), in which users fill out their MySQL database information, for the system to use. This information is then written, in hash form, to a file that's located at
"$ENV{DOCUMENT_ROOT}/../systemname.cfv"
Which is then retrieved by my configuration script.
Now, in practice and testing situations, this has worked perfectly fine. However, I've been having some nagging doubts recently: what happens when this system is installed on two subdomains of the same main domain? Will the second installations config file clobber the first installation's, or is this okay?
On my servers (a pretty typical configuration) each subdomain is in a directory below the public_html of the root domain. A CGI in the subdomain has its DOCUMENT_ROOT as it own root directory. So it would not have any issues on my systems, but it is possible that some setups would.
Personally I would change your approach so that the systemname.cfv had a unique name for each sub-domain thus they would not clash with each other. I would also be inclined to save it in the same directory as the CGI itself, or in a directory off the document root.
Although it is not a Perl application, the techniques used in MySQL's Eventum event manager ( a PHP application ) are worthy of study. It does pretty much what youare doing.
If the hostnames are unique this should work:
"$ENV{DOCUMENT_ROOT}/../$ENV{HTTP_HOST}.cfv"
perlmonks.org content © perlmonks.org and Anonymous Monk, jdtoronto, Spidy
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03