Apache2::Module::get_config: s is not of type Apache2::ServerRec

Samuel Gómez <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAJ8r+kFRMdSYrvZ+M2vBcOAmzXNLcVEa3jsfwtRtu3s1G7f36g@mail.gmail.com>
Hi all,

When I call to this function:
sub config_get {
  my $s = Apache2::ServerUtil->server;
  print STDERR "ref(s): " . ref($s)) . "\n";
  my $cfg = Apache2::Module->get_config(__PACKAGE__, $s);
  return $cfg;
}

I get this output:
ref(s): Apache2::ServerRec
[error] [client 127.0.0.1] Apache2::Module::get_config: s is not of type
Apache2::ServerRec

By contrast I expected it to work as cited in
http://perl.apache.org/docs/2.0/user/config/custom.html#Creating_and_Using_Custom_Configuration_Directives
or used in these examples:
https://svn.apache.org/repos/asf/spamassassin/branches/check_plugin/spamd-apache2/lib/Mail/SpamAssassin/Spamd/Apache2/Config.pm
http://cpan-search.sourceforge.net/Apache2/DocServer.pm.html
http://mail-archives.apache.org/mod_mbox/perl-modperl/200606.mbox/%[email protected]%3E

Can be anything wrong with my code?

Note that ref($s) successfully returns "Apache2::ServerRec". However the
code crashes anyway.

Also I've tried with
my $cfg = Apache2::Module->get_config($s);
and it runs sucessfully, but I'm not sure whether omitting that parameter
may be convenient for the purpose of the code.

Thank you very much.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.