.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 .\" ======================================================================== .\" .IX Title "docs::api::ModPerl::Global 3pm" .TH docs::api::ModPerl::Global 3pm 2024-03-29 "perl v5.38.2" "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 ModPerl::Global \-\- Perl API for manipulating special Perl lists .SH Synopsis .IX Header "Synopsis" .Vb 2 \& use ModPerl::Global (); \& my $package = \*(AqMyApache2::Package\*(Aq; \& \& # make the END blocks of this package special \& ModPerl::Global::special_list_register(END => $package); \& \& # Execute all encoutered END blocks from this package now \& ModPerl::Global::special_list_call( END => $package); \& \& # delete the list of END blocks \& ModPerl::Global::special_list_clear( END => $package); .Ve .SH Description .IX Header "Description" \&\f(CW\*(C`ModPerl::Global\*(C'\fR provides an API to manipulate special perl lists. At the moment only the \f(CW\*(C`END\*(C'\fR blocks list is supported. .PP This API allows you to change the normal Perl behavior, and execute special lists when you need to. .PP For example \&\f(CW\*(C`ModPerl::RegistryCooker\*(C'\fR uses it to run \f(CW\*(C`END\*(C'\fR blocks in the scripts at the end of each request. .PP Before loading a module containing package \f(CW$package\fR, you need to register it, so the special blocks will be intercepted by mod_perl and not given to Perl. \f(CW\*(C`special_list_register\*(C'\fR does that. Later on when you want to execute the special blocks, \&\f(CW\*(C`special_list_call\*(C'\fR should be called. Unless you want to call the list more than once, clear the list with \&\f(CW\*(C`special_list_clear\*(C'\fR. .SH API .IX Header "API" \&\f(CW\*(C`ModPerl::Global\*(C'\fR provides the following methods: .ie n .SS """special_list_call""" .el .SS \f(CWspecial_list_call\fP .IX Subsection "special_list_call" Call the special list .PP .Vb 1 \& $ok = special_list_call($key => $package); .Ve .ie n .IP "arg1: $key ( string )" 4 .el .IP "arg1: \f(CW$key\fR ( string )" 4 .IX Item "arg1: $key ( string )" The name of the special list. At the moment only \f(CW\*(AqEND\*(Aq\fR is supported. .ie n .IP "arg2: $package ( string )" 4 .el .IP "arg2: \f(CW$package\fR ( string )" 4 .IX Item "arg2: $package ( string )" what package to special list is for .ie n .IP "ret: $ok ( boolean )" 4 .el .IP "ret: \f(CW$ok\fR ( boolean )" 4 .IX Item "ret: $ok ( boolean )" true value if \f(CW$key\fR is known, false otherwise. .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .ie n .SS """special_list_clear""" .el .SS \f(CWspecial_list_clear\fP .IX Subsection "special_list_clear" Clear the special list .PP .Vb 1 \& $ok = special_list_clear($key => $package); .Ve .ie n .IP "arg1: $key ( string )" 4 .el .IP "arg1: \f(CW$key\fR ( string )" 4 .IX Item "arg1: $key ( string )" The name of the special list. At the moment only \f(CW\*(AqEND\*(Aq\fR is supported. .ie n .IP "arg2: $package ( string )" 4 .el .IP "arg2: \f(CW$package\fR ( string )" 4 .IX Item "arg2: $package ( string )" what package to special list is for .ie n .IP "ret: $ok ( boolean )" 4 .el .IP "ret: \f(CW$ok\fR ( boolean )" 4 .IX Item "ret: $ok ( boolean )" true value if \f(CW$key\fR is known, false otherwise. .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .ie n .SS """special_list_register""" .el .SS \f(CWspecial_list_register\fP .IX Subsection "special_list_register" Register the special list .PP .Vb 1 \& $ok = special_list_call($key => $package); .Ve .ie n .IP "arg1: $key ( string )" 4 .el .IP "arg1: \f(CW$key\fR ( string )" 4 .IX Item "arg1: $key ( string )" The name of the special list. At the moment only \f(CW\*(AqEND\*(Aq\fR is supported. .ie n .IP "arg2: $package ( string )" 4 .el .IP "arg2: \f(CW$package\fR ( string )" 4 .IX Item "arg2: $package ( string )" what package to special list is for .ie n .IP "ret: $ok ( boolean )" 4 .el .IP "ret: \f(CW$ok\fR ( boolean )" 4 .IX Item "ret: $ok ( boolean )" true value if \f(CW$key\fR is known, false otherwise. .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PP Notice that you need to register the package before it is loaded. If you register it after, Perl has already compiled the \f(CW\*(C`END\*(C'\fR blocks and there are no longer under your control. .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.