|Think about Loose Coupling|
mod_perl2 Apache VirtualHost ENV settings [OT?]by graq (Curate)
|on Feb 06, 2008 at 15:13 UTC||Need Help??|
graq has asked for the
wisdom of the Perl Monks concerning the following question:
I have a module that handles database connections. It is used by standard CGI scripts as well as mod_perl2 modules.
The server hosts multiple sites, set up using Apache's VirtualHost configuration.
Using SetEnv (or PerlSetEnv), polutes across to other Apache requests, as %ENV is treated much like a mass global variable for all Apache's requests under MP2
Here is an example sample of code that does not work:
This then allows MP2 and scripts alike to connect via ORMs (Class::DBI & DBIx::Class) to which ever DB is appropriate
The aim being to then configure apache for www.mysite.com and qa.mysite.com to use exactly the same code, but restrict access to db2, and use a different set of data for QA (allowing them to CRUD as much as they like).
-=( Graq )=-