|Perl Monk, Perl Meditation|
Running Perl scripts from a single CGI-BIN, on a multiple-virtual hosting serverby ajt (Prior)
|on Oct 02, 2001 at 17:48 UTC||Need Help??|
ajt has asked for the wisdom of the Perl Monks concerning the following question:
This question springs from a recent conversation I had with btrott and his rather excellent STAMP script.
Imagine if you will a typical Apache box, it's got one shared CGI-BIN, or mod_perl folder that is shared by all the various virtual domains on the box. Each domain looks different, so I want to make the script look different too.
QUESTION how do you neatly configure the script for all the various domains?
You can ask CGI to give you the virtual host name, and then check to see if there is a configuration file for it, if not you read a default one. This is what I tried, see code below. It works okay, but you'll end up with a folder full of config files, one per script per host, which may get messy.
So my question is, how do you neatly write CGI/mod_Perl script so that they can be shared on a mass-hosting Apache box, and yet maintain their own look'n'feel (via config), and what have you.
$CFG_FILE is what STAMP expects to use, and error is it's error handling routine.
This is an addition to STAMP, I used for ilustration purposes. STAMP is cool, get it your self from it's author.
As ever thanks in advance.