I've recently moved to Apache2, and I'm now at my wit's end with custom
configuration directives.  I have them defined and working, following the
examples in the docs, but the merging behavior is proving difficult to
understand.

(Using mod_perl 2.0.2, apache 2.0.55, perl 5.8.7, FreeBSD 6.0RC1.)

At this point I'm not concerned with directory containers, I'm just
trying to get virtual hosts to work the way I want with directives that
apply server-wide.  The docs say: "If these functions are not supplied
the following default behavior takes place: the child container inherits
its parent configuration, unless it specifies its own and then it
overrides its parent configuration."

As luck would have it, this is exactly the behavior I want, so I figure
I'm good to go.  Unfortunately, this isn't what actually happens by
default.  What actually happens is that the virtual host inherits the
main server's configuration, but if *any* directives from the module
are specified within the virtual host, *none* of them are inherited and
the entire configuration must be repeated in the virtual host.

So, following what I think the docs are saying (they are pretty
incomprehensible on this subject) I add a simple SERVER_MERGE function
that merges the two hashes to try to duplicate what I thought was the
default behavior.  I observe no change, so I try increasingly crazy
things in this function, debug dumps, and ultimately deliberate fatal
run-time errors, and determine that this function is in fact never
getting called at all.

So, either I'm retrieving the values incorrectly, or I'm misunderstanding
the default behavior.

my $cfg = Apache2::Module::get_config(__PACKAGE__,$r->server,
                                      $r->per_dir_config);

(It makes no difference whether the per_dir_config thing is in there,
which I don't think it should since I'm not even trying directory
containers at this point.)  Using the above, the only way any of the
directives are inherited by the virtual host is if I specify none of
them within the virtual host section.  If any directives from the
module are specified, those are the only ones that appear.

And, I must be missing the part about how to get my SERVER_MERGE function
to be called.  The examples in the docs do not work as-is.

Any clues would be greatly appreciated.

-- 
Jeremy  |  [EMAIL PROTECTED]

Reply via email to