Erik Norgaard wrote:
I have successfully created a module that declares some configuration
parameters which should be available to the handler: dbDriver, dbHost,
dbName, dbUser and dbPassword. Or so I think, I followed this guide:
http://perl.apache.org/docs/2.0/user/config/custom.html
Something is wrong, I can't read the variables, or they are undefined.
What am I missing?
I have in the handler-module declared variables $dbDriver, $dbHost etc.
and use this method to set them:
use Apache2::Module;
my $dbDriver;
my $dbHost;
sub handler { # basicly this:
my $r = shift;
config($r);
print $dbHost;
}
sub config {
my $r = shift;
my $conf = Apache2::Module::get_config('XCMS::Config', $r->server);
$dbDriver = $conf->{'XCMSdbDriver'};
$dbHost = $conf->{'XCMSdbHost'};
}
The config($r) is called from the handler, and for testing I just print
the value of the $dbHost.
And this is in XCMS::Config:
use Apache2::CmdParms;
use Apache2::Module;
use Apache2::Directive;
my @directives = (
{ name => 'XCMSdbDriver', args_how => "Apache2::Const::RAW_ARGS" },
{ name => 'XCMSdbHost', args_how => "Apache2::Const::RAW_ARGS" },
);
Apache2::Module::add(__PACKAGE__, [EMAIL PROTECTED]);
...
sub XCMSdbHost {
my ($self, $parms, $val) = @_;
$self->{'XCMSdbHost'} = $val;
};
And this in the configuration of the virtual host
PerlLoadModule XCMS::Config
XCMSdbDriver Pg
XCMSdbHost localhost
But the variable remain undefined...
Thanks, Erik
--
Ph: +34.666334818 web: http://www.locolomo.org
X.509 Certificate: http://www.locolomo.org/crt/8D03551FFCE04F0C.crt
Key ID: 69:79:B8:2C:E3:8F:E7:BE:5D:C3:C3:B1:74:62:B8:3F:9F:1F:69:B9