On Tue, 24 Jul 2001, [iso-8859-1] Frédéric Schwien wrote:

> Hi,
>
> I would like to have a config file like /etc/mywebapp.conf where I would
> put all my modules configuration. Then I would have a WebApp::LoadConfig
> module that would run from startup.pl, and initialize my Perl modules
> default variables at Apache start.
>
> My config file would be some like :
>
> ### /etc/mywebapp.conf
> ###
> ###
> MyPackageOne::Default_Value_One = 1
> MyPackageOne::Default_Value_One = 2
>
> and my startup.pl would have :
>
> ### startup.pl
> WebApp::LoadConfig->run("/etc/mywebapp.conf")
>
> Of course,this means that i would have to use those modules whithin
> mod_perl only, or have to call that
> WebApp::LoadConfig->run("/etc/mywebapp.conf") at the begining of each
> console script that use those modules ...
>
> Would this be a good idea ? What do you think about? does somebody
> already use it ?

If I understand you correctly you want to be able to have a few conf files
and load one of them depending on environment. Here is how I do that (well
sort of) :

/tmp/dev.pl
------
package My::Config;
$env = 'dev';
1;

/tmp/prod.pl
------
package My::Config;
$env = 'prod';
1;

startup.pl:
-----------
require "/tmp/env.pl";

now if I'm in the prod env I do:

% ln -sf /tmp/prod.pl /tmp/env.pl

now if I'm in the pdev env I do:

% ln -sf /tmp/dev.pl /tmp/env.pl

C'est tout!

Of course replace /tmp with something else. I've used it as an example.

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Reply via email to