Re: WELCOME to modperl@perl.apache.org

Re: WELCOME to modperl@perl.apache.org

am 17.04.2008 17:49:38 von Zsolt Kecskemeti

------=_Part_28804_10518243.1208447378403
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

At http://perl.apache.org/docs/2.0/user/config/custom.html#C_SE RVER_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

------=_Part_28804_10518243.1208447378403
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

At
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

------=_Part_28804_10518243.1208447378403--