You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Zsolt Kecskemeti <ke...@gmail.com> on 2008/04/17 17:49:38 UTC

Re: WELCOME to modperl@perl.apache.org

Hi,

At http://perl.apache.org/docs/2.0/user/config/custom.html#C_SERVER_CREATE_it
should be noted about this function (and also about DIR_CREATE) that
it
will be called if there is at least one custom directive present in
httpd.conf.

So setting so called 'system defaults' is not possible this way because if
you do not have at least one directive in your httpd.conf, then the server
configuration object will not get initialised.

For example if I have this in MyParams.pm:

sub SERVER_CREATE {
    my ($class, $parms) = @_;
    return bless {
        'name'     => __PACKAGE__,
        'MyParam1' => '2',
        'MyParam2' => '4',
    }, $class;
}


and in my httpd.conf I want to get server defaults by commenting out some
MyParam values like

PerlLoadModule MyParams

#MyParam1 1
#MyParam2 0

then if in my code I try to access the server configuration object like this


my $srv_cfg = Apache2::Module::get_config('MyParams',
Apache2::ServerUtil->server);

I get undef.

Is this a bug or a feature? The documentation suggests that it will be
called all the time and event suggests to use it to preset some values here
if necessary.

Regards,
Zsolt Kecskemeti