.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "libapache2-mod-perl2-2.0.11::docs::api::Apache2::Module 3pm" .TH libapache2-mod-perl2-2.0.11::docs::api::Apache2::Module 3pm "2021-05-21" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Apache2::Module \- Perl API for creating and working with Apache modules .SH "Synopsis" .IX Header "Synopsis" .Vb 1 \& use Apache2::Module (); \& \& #Define a configuration directive \& my @directives = ( \& { \& name => \*(AqMyDirective\*(Aq, \& } \& ); \& \& Apache2::Module::add(_\|_PACKAGE_\|_, \e@directives); \& \& # iterate over the whole module list \& for (my $modp = Apache2::Module::top_module(); $modp; $modp = $modp\->next) { \& my $name = $modp\->name; \& my $index = $modp\->module_index; \& my $ap_api_major_version = $modp\->ap_api_major_version; \& my $ap_api_minor_version = $modp\->ap_api_minor_version; \& my $commands = $modp\->cmds; \& } \& \& # find a specific module \& my $module = Apache2::Module::find_linked_module(\*(Aqmod_ssl.c\*(Aq); \& \& # remove a specific module \& $module\->remove_loaded_module(); \& \& # access module configuration from a directive \& sub MyDirective { \& my ($self, $parms, $args) = @_; \& my $srv_cfg = Apache2::Module::get_config($self, $parms\->server); \& [...] \& } \& \& # test if an Apache module is loaded \& if (Apache2::Module::loaded(\*(Aqmod_ssl.c\*(Aq)) { \& [...] \& } \& \& # test if a Perl module is loaded \& if (Apache2::Module::loaded(\*(AqApache2::Status\*(Aq)) { \& [...] \& } .Ve .SH "Description" .IX Header "Description" \&\f(CW\*(C`Apache2::Module\*(C'\fR provides the Perl \s-1API\s0 for creating and working with Apache modules .PP See Apache Server Configuration Customization in Perl. .SH "API" .IX Header "API" \&\f(CW\*(C`Apache2::Module\*(C'\fR provides the following functions and/or methods: .ie n .SS """add""" .el .SS "\f(CWadd\fP" .IX Subsection "add" Add a module's custom configuration directive to Apache. .PP .Vb 1 \& Apache2::Module::add($package, $cmds); .Ve .ie n .IP "arg1: $package ( string )" 4 .el .IP "arg1: \f(CW$package\fR ( string )" 4 .IX Item "arg1: $package ( string )" the package of the module to add .ie n .IP "arg2: $cmds ( \s-1ARRAY\s0 of \s-1HASH\s0 refs )" 4 .el .IP "arg2: \f(CW$cmds\fR ( \s-1ARRAY\s0 of \s-1HASH\s0 refs )" 4 .IX Item "arg2: $cmds ( ARRAY of HASH refs )" the list of configuration directives to add .IP "ret: no return value" 4 .IX Item "ret: no return value" .PD 0 .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .PP See also Apache Server Configuration Customization in Perl. .ie n .SS """ap_api_major_version""" .el .SS "\f(CWap_api_major_version\fP" .IX Subsection "ap_api_major_version" Get the httpd \s-1API\s0 version this module was build against, \fBnot\fR the module's version. .PP .Vb 1 \& $major_version = $module\->ap_api_major_version(); .Ve .ie n .IP "obj: $module ( ""Apache2::Module object"" )" 4 .el .IP "obj: \f(CW$module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "obj: $module ( Apache2::Module object )" .PD 0 .ie n .IP "ret: $major_version ( integer )" 4 .el .IP "ret: \f(CW$major_version\fR ( integer )" 4 .IX Item "ret: $major_version ( integer )" .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .PP This methid is used to check that module is compatible with this version of the server before loading it. .ie n .SS """ap_api_minor_version""" .el .SS "\f(CWap_api_minor_version\fP" .IX Subsection "ap_api_minor_version" Get the module \s-1API\s0 minor version. .PP .Vb 1 \& $minor_version = $module\->ap_api_minor_version(); .Ve .ie n .IP "obj: $module ( ""Apache2::Module object"" )" 4 .el .IP "obj: \f(CW$module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "obj: $module ( Apache2::Module object )" .PD 0 .ie n .IP "ret: $minor_version ( integer )" 4 .el .IP "ret: \f(CW$minor_version\fR ( integer )" 4 .IX Item "ret: $minor_version ( integer )" .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .PP \&\f(CW\*(C`ap_api_minor_version()\*(C'\fR provides \s-1API\s0 feature milestones. .PP It's not checked during module init. .ie n .SS """cmds""" .el .SS "\f(CWcmds\fP" .IX Subsection "cmds" Get the \f(CW\*(C`Apache2::Command\*(C'\fR object, describing all of the directives this module defines. .PP .Vb 1 \& $command = $module\->cmds(); .Ve .ie n .IP "obj: $module ( ""Apache2::Module object"" )" 4 .el .IP "obj: \f(CW$module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "obj: $module ( Apache2::Module object )" .PD 0 .ie n .IP "ret: $command ( ""Apache2::Command object"" )" 4 .el .IP "ret: \f(CW$command\fR ( \f(CWApache2::Command object\fR )" 4 .IX Item "ret: $command ( Apache2::Command object )" .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .ie n .SS """get_config""" .el .SS "\f(CWget_config\fP" .IX Subsection "get_config" Retrieve a module's configuration. Used by configuration directives. .PP .Vb 4 \& $cfg = Apache2::Module::get_config($class, $server, $dir_config); \& $cfg = Apache2::Module::get_config($class, $server); \& $cfg = $self\->get_config($server, $dir_config); \& $cfg = $self\->get_config($server); .Ve .ie n .IP "obj: $module ( ""Apache2::Module object"" )" 4 .el .IP "obj: \f(CW$module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "obj: $module ( Apache2::Module object )" .PD 0 .ie n .IP "arg1: $class ( string )" 4 .el .IP "arg1: \f(CW$class\fR ( string )" 4 .IX Item "arg1: $class ( string )" .PD The Perl package this configuration is for .ie n .IP "arg2: $server ( ""Apache2::ServerRec object"" )" 4 .el .IP "arg2: \f(CW$server\fR ( \f(CWApache2::ServerRec object\fR )" 4 .IX Item "arg2: $server ( Apache2::ServerRec object )" The current server, typically \&\f(CW\*(C`$r\->server\*(C'\fR or \&\f(CW\*(C`$parms\->server\*(C'\fR. .ie n .IP "opt arg3: $dir_config ( ""Apache2::ConfVector object"" )" 4 .el .IP "opt arg3: \f(CW$dir_config\fR ( \f(CWApache2::ConfVector object\fR )" 4 .IX Item "opt arg3: $dir_config ( Apache2::ConfVector object )" By default, the configuration returned is the server level one. To retrieve the per directory configuration, use \&\f(CW\*(C`$r\->per_dir_config\*(C'\fR as a last argument. .ie n .IP "ret: $cfg (\s-1HASH\s0 reference)" 4 .el .IP "ret: \f(CW$cfg\fR (\s-1HASH\s0 reference)" 4 .IX Item "ret: $cfg (HASH reference)" A reference to the hash holding the module configuration data. .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PP See also Apache Server Configuration Customization in Perl. .ie n .SS """find_linked_module""" .el .SS "\f(CWfind_linked_module\fP" .IX Subsection "find_linked_module" Find a module based on the name of the module .PP .Vb 1 \& $module = Apache2::Module::find_linked_module($name); .Ve .ie n .IP "arg1: $name ( string )" 4 .el .IP "arg1: \f(CW$name\fR ( string )" 4 .IX Item "arg1: $name ( string )" The name of the module ending in \f(CW\*(C`.c\*(C'\fR .ie n .IP "ret: $module ( ""Apache2::Module object"" )" 4 .el .IP "ret: \f(CW$module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "ret: $module ( Apache2::Module object )" The module object if found, \f(CW\*(C`undef\*(C'\fR otherwise. .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PP For example: .PP .Vb 1 \& my $module = Apache2::Module::find_linked_module(\*(Aqmod_ssl.c\*(Aq); .Ve .ie n .SS """loaded""" .el .SS "\f(CWloaded\fP" .IX Subsection "loaded" Determine if a certain module is loaded .PP .Vb 1 \& $loaded = Apache2::Module::loaded($module); .Ve .ie n .IP "name: $module ( string )" 4 .el .IP "name: \f(CW$module\fR ( string )" 4 .IX Item "name: $module ( string )" The name of the module to search for. .Sp If \f(CW$module\fR ends with \f(CW\*(C`.c\*(C'\fR, search all the modules, statically compiled and dynamically loaded. .Sp If \f(CW$module\fR ends with \f(CW\*(C`.so\*(C'\fR, search only the dynamically loaded modules. .Sp If \f(CW$module\fR doesn't contain a \f(CW\*(C`.\*(C'\fR, search the loaded Perl modules (checks \f(CW%INC\fR). .ie n .IP "ret: $loaded ( boolean )" 4 .el .IP "ret: \f(CW$loaded\fR ( boolean )" 4 .IX Item "ret: $loaded ( boolean )" Returns true if the module is loaded, false otherwise. .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PP For example, to test if this server supports ssl: .PP .Vb 3 \& if (Apache2::Module::loaded(\*(Aqmod_ssl.c\*(Aq)) { \& [...] \& } .Ve .PP To test is this server dynamically loaded mod_perl: .PP .Vb 3 \& if (Apache2::Module::loaded(\*(Aqmod_perl.so\*(Aq)) { \& [...] \& } .Ve .PP To test if \f(CW\*(C`Apache2::Status\*(C'\fR is loaded: .PP .Vb 3 \& if (Apache2::Module::loaded(\*(AqApache2::Status\*(Aq)) { \& [...] \& } .Ve .ie n .SS """module_index""" .el .SS "\f(CWmodule_index\fP" .IX Subsection "module_index" Get the index to this modules structures in config vectors. .PP .Vb 1 \& $index = $module\->module_index(); .Ve .ie n .IP "obj: $module ( ""Apache2::Module object"" )" 4 .el .IP "obj: \f(CW$module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "obj: $module ( Apache2::Module object )" .PD 0 .ie n .IP "ret: $index ( integer )" 4 .el .IP "ret: \f(CW$index\fR ( integer )" 4 .IX Item "ret: $index ( integer )" .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .ie n .SS """name""" .el .SS "\f(CWname\fP" .IX Subsection "name" Get the name of the module's \fI.c\fR file .PP .Vb 1 \& $name = $module\->name(); .Ve .ie n .IP "obj: $module ( ""Apache2::Module object"" )" 4 .el .IP "obj: \f(CW$module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "obj: $module ( Apache2::Module object )" .PD 0 .ie n .IP "ret: $name ( string )" 4 .el .IP "ret: \f(CW$name\fR ( string )" 4 .IX Item "ret: $name ( string )" .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .PP For example a mod_perl module, will return: \fImod_perl.c\fR. .ie n .SS """next""" .el .SS "\f(CWnext\fP" .IX Subsection "next" Get the next module in the list, \f(CW\*(C`undef\*(C'\fR if this is the last module in the list. .PP .Vb 1 \& $next_module = $module\->next(); .Ve .ie n .IP "obj: $module ( ""Apache2::Module object"" )" 4 .el .IP "obj: \f(CW$module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "obj: $module ( Apache2::Module object )" .PD 0 .ie n .IP "ret: $next_module ( ""Apache2::Module object"" )" 4 .el .IP "ret: \f(CW$next_module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "ret: $next_module ( Apache2::Module object )" .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .ie n .SS """remove_loaded_module""" .el .SS "\f(CWremove_loaded_module\fP" .IX Subsection "remove_loaded_module" Remove a module from the list of loaded modules permanently. .PP .Vb 1 \& $module\->remove_loaded_module(); .Ve .ie n .IP "obj: $module ( ""Apache2::Module object"" )" 4 .el .IP "obj: \f(CW$module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "obj: $module ( Apache2::Module object )" .PD 0 .IP "ret: no return value" 4 .IX Item "ret: no return value" .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .ie n .SS """top_module""" .el .SS "\f(CWtop_module\fP" .IX Subsection "top_module" Returns the first module in the module list. Useful to start a module iteration. .PP .Vb 1 \& $module = Apache2::Module::top_module(); .Ve .ie n .IP "ret: $module ( ""Apache2::Module object"" )" 4 .el .IP "ret: \f(CW$module\fR ( \f(CWApache2::Module object\fR )" 4 .IX Item "ret: $module ( Apache2::Module object )" .PD 0 .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PD .SH "See Also" .IX Header "See Also" mod_perl 2.0 documentation. .SH "Copyright" .IX Header "Copyright" mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0. .SH "Authors" .IX Header "Authors" The mod_perl development team and numerous contributors.