Hello,
On Sunday 23 October 2005 00:31, Ron Savage wrote:
> Which method do people use to handle the senario in the Subject:
>
> o DSN/user/pass in the environment?
> - If so, you do configure Apache to set the env on a per-location basis?
>
> o Ditto in config files?
> - If so, how do you specify which config file?
i usually pass the configuration filename via PARAMS to the new method and
then load appropriate configuration in the cgiapp_init method:
-- script.cgi --------------------------
use Day::App::Search;
Day::App::Search->new(
PARAMS => {
config_filename => '/home/httpd/ristoservice/etc/day-new.conf'
}
)->run;
-- ca_class.pm ----------------------
sub cgiapp_init {
my $self = shift;
$self->param(
'CONFIGURATION' => Day::Configuration->instance(
config_filename => $self->param('config_filename')
)
);
[...]
-- configuration_class.pm ---------
package Day::Configuration;
use base 'AKOMI::Configuration::Base', 'Class::Singleton';
sub _defaults {
my $self = shift;
my $defaults = $self->SUPER::_defaults;
$defaults->{delimiter} = '/';
$defaults->{config_filename} = '/home/httpd/ristoservice/etc/day.conf';
$defaults->{config_env_var} = 'DC_CONF';
return $defaults;
}
this solution works very well in small environments, where changing the
config_filename parameter in few files is not difficult; when dealing with
complex applications the env solution is useful, so I wrote base
configuration class which accepts a config_filename parameter or searches for
a variable in the environment or uses a default value.
Ciao, Valerio
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.