Apache::Module - Perl API for creating and working with Apache modules |
cmds
get_config
find_linked_module
loaded
minor_version
module_index
name
next
remove_loaded_module
top_module
version
Apache::Module - Perl API for creating and working with Apache modules
use Apache::Module ();
# iterate over the whole module list for (my $modp = Apache::Module->top_module; $modp; $modp = $modp->next) { my $name = $modp->name; my $version = $modp->version; my $minor_version = $modp->minor_version; my $index = $modp->module_index; my $commands = $modp->cmds; }
# find a specific module my $module = Apache::Module::find_linked_module('mod_ssl.c');
# remove a specific module $module->remove_loaded_module();
# access module configuration from a directive sub MyDirective { my ($self, $parms, $args) = @_; my $srv_cfg = Apache::Module->get_config($self, $parms->server); [...] }
# test if an Apache module is loaded if (Apache::Module::loaded('mod_ssl.c')) { [...] }
# test if a Perl module is loaded if (Apache::Module::loaded('Apache::Status')) { [...] }
Apache::Module
provides the Perl API for creating and working with
Apache modules
See Apache Server Configuration Customization in Perl.
Apache::Module
provides the following functions and/or methods:
cmds
The Apache::Command|docs::2.0::api::Apache::Command
object
that describes all of the directives this module defines.
$commands = $module->cmds();
$module
( Apache::Module object|docs::2.0::api::Apache::Module
)$commands
( Apache::Command object|docs::2.0::api::Apache::Command
)
get_config
Retrieves a module's configuration. Used by configuration directives.
$cfg = Apache::Module->get_config($class, $server, [$dir_config]); $cfg = $self->get_config($server, [$dir_config]);
$module
( Apache::Module object|docs::2.0::api::Apache::Module
)$class
( string )$server
( Apache::ServerRec object|docs::2.0::api::Apache::ServerRec
)$r->server
or $parms->server
$dir_config
( Apache::ConfVector object|docs::2.0::api::Apache::ConfVector
)$r->per_dir_config
as a last
argument.
$cfg
(HASH reference)See also Apache Server Configuration Customization in Perl
find_linked_module
Find a module based on the name of the module
$module = Apache::Module::find_linked_module($name);
$name
( string ).c
$module
( Apache::Module object|docs::2.0::api::Apache::Module
)
loaded
Determines if a certain module is loaded
$loaded = Apache::Module::loaded($module);
$module
( string )If $module
ends with .c
, search all the modules,
statically compiled and dynamically loaded.
If $module
ends with .so
, search only the dynamically
loaded modules.
If $module
doesn't contain a .
, search the loaded Perl
modules.
$loaded
( boolean )For example, to test if this server supports ssl:
if (Apache::Module::loaded('mod_ssl.c')) { [...] }
To test is this server dynamically loaded mod_perl:
if (Apache::Module::loaded('mod_perl.so')) { [...] }
To test if Apache::Status|docs::2.0::api::Apache::Status
is
loaded:
if (Apache::Module::loaded('Apache::Status')) { [...] }
minor_version
API minor version. Provides API feature milestones. Not checked during module init
$minor_version = $module->minor_version();
$module
( Apache::Module object|docs::2.0::api::Apache::Module
)$minor_version
( integer )
module_index
Index to this modules structures in config vectors.
$index = $module->module_index();
$module
( Apache::Module object|docs::2.0::api::Apache::Module
)$index
( integer )
name
The name of the module's C file
$name = $module->name();
$module
( Apache::Module object|docs::2.0::api::Apache::Module
)$name
( string )
next
The next module in the list, undef if the last module in the list.
$next_module = $module->next();
$module
( Apache::Module object|docs::2.0::api::Apache::Module
)$next_module
( Apache::Module object|docs::2.0::api::Apache::Module
)
remove_loaded_module
Remove a module from the list of loaded modules permanently.
$module->remove_loaded_module();
$module
( Apache::Module object|docs::2.0::api::Apache::Module
)
top_module
Returns the first module in the module list. Usefull to start a module iteration.
$ret = Apache::Module->top_module();
Apache::Module
( class name )$ret
( Apache::Module object|docs::2.0::api::Apache::Module
)
version
API version, not module version; check that module is compatible with this version of the server.
$version = $module->version();
$module
( Apache::Module object|docs::2.0::api::Apache::Module
)$version
( integer )
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.
The mod_perl development team and numerous contributors.
Apache::Module - Perl API for creating and working with Apache modules |