Hello all, I'm running mod_perl-2.0.1 on apache-2.0.54 and OS X 10.4. Trying to get a custom apache config directive to work I run into what appears to be a rather odd problem. It looks like the subroutine handling the directive is passed a different object from the one being passed to SERVER_CREATE and when I call Apache2::Module::get_config(). The code being called is as follows (more or less stolen straight from the perl.apache.org docs):
### BEGIN CODE ### package ARS2; use strict; use warnings; use Apache2::CmdParms qw//; use Apache2::Const -compile => qw/RSRC_CONF TAKE1 OK/; use Apache2::Module qw//; use Apache2::ServerRec qw//; use Apache2::ServerUtil qw//; my @directives = ( { name => "ARS2ConfigFile", #func => \&handle_directive, # For some reason hard references fail to work errmsg => "ARS2ConfigFile /path/to/arsconfig.xml", req_override => Apache2::Const::RSRC_CONF, args_how => Apache2::Const::TAKE1, }, ); Apache2::Module::add ( __PACKAGE__, [EMAIL PROTECTED] ); sub ARS2ConfigFile { my ($self, $parms, $arg) = @_; use Data::Dumper qw//; my $dump = Data::Dumper::Dumper ( $self ); Apache2::ServerUtil->server ()->log ()->error ( "ARS2ConfigFile $arg $self $parms $dump " ); $self->{ "ARS2ConfigFile" } = $arg; } sub SERVER_CREATE { my ($package, $parms) = @_; my $self = { ARS2ConfigFile => "/usr/local/etc/ars2/arsconfig.xml" }; Apache2::ServerUtil->server ()->log ()->error ( "SERVER_CREATE $self" ); return bless $self => $package; #return bless { ARS2ConfigFile => "/usr/local/etc/ars2/arsconfig.xml" } => $package; } sub SERVER_MERGE { my ($base, $add) = @_; my $val = $add->{ "ARS2ConfigFile" } || $base->{ "ARS2ConfigFile" }; Apache2::ServerUtil->server ()->log ()->error ( "SERVER_MERGE $base $add" ); return bless { ARS2ConfigFile => $val } => ref $base; } ### END CODE ### The code fetching the config value is stolen straight from the docs as well: ### BEGIN CODE ### my $config = Apache2::Module::get_config ( "ARS2", Apache2::ServerUtil->server () ); my $file = $config->{ "ARS2ConfigFile" }; Apache2::ServerUtil->server ()->log ()->error ( "Bootstrap $config '$file'" ); ### END CODE ### The code fetching the value of the config directive is being called from a PerlPostConfigHandler, but the problem persists if the code is called from a PerlResponseHandler. Starting httpd -X gives the following output to console and error.log: [Sun Aug 07 04:37:56 2005] [error] SERVER_CREATE HASH(0x116776c) [Sun Aug 07 04:37:56 2005] [error] ARS2ConfigFile /usr/local/apache2/modules/ars2-mp2/config/arsconfig.xml ARS2=HASH(0x18adbc0) Apache2::CmdParms=SCALAR(0x1880424) $VAR1 = bless( {}, 'ARS2' );\n [Sun Aug 07 04:37:21 2005] [error] Bootstrap ARS2=HASH(0x116776c) '/usr/local/etc/ars2/arsconfig.xml' Configuration Failed As you can see the boostrap method (attempting) to fetch the value is being passed the same hashref that SERVER_CREATE blessed and returned (HASH(0x116776c)), but the subroutine handling the directive is being passed a different hashref, blessed into the appropriate class, that I fail to find anywhere else in my code. Does anyone see what I might be doing wrong here? Thanks in advance, Arne :wq