Hello all, I am developing a new module which defines 2 new directives (TestDirective1 and TestDirective2). These directives are usable in a container (Location, Directory, ...). The following code defines the directives :
=====BEGIN CODE===================================== package TestDirective; use warnings; use strict; use Carp; use Apache2::Const -compile => qw(RAW_ARGS); use Apache2::CmdParms (); use Apache2::Module (); use Apache2::Directive (); use Apache2::Const qw(:common); my @directives = ( { name => 'TestDirective1', func => __PACKAGE__ . '::TestDirective1', args_how => Apache2::Const::RAW_ARGS, }, { name => 'TestDirective2', func => __PACKAGE__ . '::TestDirective2', args_how => Apache2::Const::RAW_ARGS, }, ); Apache2::Module::add(__PACKAGE__, [EMAIL PROTECTED]); sub TestDirective1 { my ($self, $parms, $arg) = @_; print STDERR "hello\n"; $self->{TestDirective1} = 'hello'; return; } sub TestDirective2 { my ($self, $parms, $arg) = @_; my $td1 = Apache2::Module::get_config(__PACKAGE__, $parms->server); if (defined $td1){ print STDERR "world\n"; } $self->{TestDirective2} = 'world'; return; } sub response { my ($self,$r) = @_; print 'hello world'; return OK; } 1; =====END CODE====================================== When using the new directives with the following configuration file =====BEGIN CONFIG====================================== PerlLoadModule TestDirective; <Location /test> SetHandler perl-script TestDirective1 TestDirective2 PerlResponseHandler TestDirectives->response </Location> =====END CONFIG====================================== STDERR output, when starting Apache, is "hello world" => correct But when using the new directives with the following configuration file =====BEGIN CONFIG====================================== PerlLoadModule TestDirective; <Location /test> SetHandler perl-script TestDirective2 PerlResponseHandler TestDirectives->response </Location> =====END CONFIG====================================== STDERR output, when starting Apache, is "world" => incorrect STDERR is not empty (it should) What is wrong in the TestDirective::TestDirective2 function ? Which test do I have to apply ('defined $td1' is not the correct test !!!) ? Thanks Gaetan