You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by George Sanderson <ge...@xorgate.com> on 2002/03/14 01:43:47 UTC

If mod_perl module loaded from within httpd.conf

What is the best way to check from within the httpd.conf file if a mod_perl
module is loaded.  For C modules, I can use:
<IfModule mod_perl.c> ... </IfModule>
to conditionally load it's directives.
Is there a similar conditional syntax for the mod_perl script modules?
I only want a module's directives to be processed when that module is loaded.

+================================+
| George Sanderson <ge...@xorgate.com>
| http://www.xorgate.com
+================================+


Re: If mod_perl module loaded from within httpd.conf

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

George Sanderson wrote:

> What is the best way to check from within the httpd.conf file if a mod_perl
> module is loaded.  For C modules, I can use:
> <IfModule mod_perl.c> ... </IfModule>
> to conditionally load it's directives.
> Is there a similar conditional syntax for the mod_perl script modules?
> I only want a module's directives to be processed when that module is loaded.


you can use the module() method from the Apache class to test for either a C 
module or a Perl one.

   $foo if Apache->module('mod_perl.c');
   $foo if Apache->module('My::Module');

see recipe 4.2 in the cookbook for a few examples, including how to use it from 
a <Perl> section in your httpd.conf

--Geoff