On Mon, 7 Aug 2000, Shimon Rura wrote:
> Perhaps there is some way I can actually use reasonable Perl scoping to set
> a variable in the scope of a Virtual Host? If so, then I could just specify
> a hash of environment variables called %myEnv in each <VirtualHost> or
> <Location> section, and the web scripts could just call a single function
> like envImport(%myEnv) at the top. That would be great, as all
> virtualHost-specific configuration would exist in Apache configuration
> files.
Put all of your variables itnto a multi-level hash that loads before the
fork in startup.pl:
my %HostEnv = (
'host1' => { 'db-user' => 'goofball'},
'host2' => { 'db-user' => 'cherryblintz'}
);
Then you can use PerlSetVar to put the key for each group of settings
inside a VirtualHost or Location. Your import function just looks up the
PerlSetVar value with $r->dir_config() and uses it as a key to get the
settings from the global hash %HostEnv.
- Perrin