.\" 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::ModPerl::Registry 3pm" .TH libapache2-mod-perl2-2.0.11::docs::api::ModPerl::Registry 3pm "2021-02-22" "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" ModPerl::Registry \- Run unaltered CGI scripts persistently under mod_perl .SH "Synopsis" .IX Header "Synopsis" .Vb 10 \& # httpd.conf \& PerlModule ModPerl::Registry \& Alias /perl/ /home/httpd/perl/ \& \& SetHandler perl\-script \& PerlResponseHandler ModPerl::Registry \& #PerlOptions +ParseHeaders \& #PerlOptions \-GlobalRequest \& Options +ExecCGI \& .Ve .SH "Description" .IX Header "Description" URIs in the form of \f(CW\*(C`http://example.com/perl/test.pl\*(C'\fR will be compiled as the body of a Perl subroutine and executed. Each child process will compile the subroutine once and store it in memory. It will recompile it whenever the file (e.g. \fItest.pl\fR in our example) is updated on disk. Think of it as an object oriented server with each script implementing a class loaded at runtime. .PP The file looks much like a \*(L"normal\*(R" script, but it is compiled into a subroutine. .PP For example: .PP .Vb 3 \& my $r = Apache2::RequestUtil\->request; \& $r\->content_type("text/html"); \& $r\->print("mod_perl rules!"); .Ve .PP \&\s-1XXX: STOPPED\s0 here. Below is the old Apache::Registry document which I haven't worked through yet. .PP \&\s-1META:\s0 document that for now we don't \fBchdir()\fR into the script's dir, because it affects the whole process under threads. \f(CW\*(C`ModPerl::RegistryPrefork\*(C'\fR should be used by those who run only under prefork \s-1MPM.\s0 .PP This module emulates the \s-1CGI\s0 environment, allowing programmers to write scripts that run under \s-1CGI\s0 or mod_perl without change. Existing \&\s-1CGI\s0 scripts may require some changes, simply because a \s-1CGI\s0 script has a very short lifetime of one \s-1HTTP\s0 request, allowing you to get away with \*(L"quick and dirty\*(R" scripting. Using mod_perl and ModPerl::Registry requires you to be more careful, but it also gives new meaning to the word \*(L"quick\*(R"! .PP Be sure to read all mod_perl related documentation for more details, including instructions for setting up an environment that looks exactly like \s-1CGI:\s0 .PP .Vb 2 \& print "Content\-type: text/html\en\en"; \& print "Hi There!"; .Ve .PP Note that each httpd process or \*(L"child\*(R" must compile each script once, so the first request to one server may seem slow, but each request there after will be faster. If your scripts are large and/or make use of many Perl modules, this difference should be noticeable to the human eye. .SH "DirectoryIndex" .IX Header "DirectoryIndex" If you are trying setup a DirectoryIndex under a Location covered by ModPerl::Registry* you might run into some trouble. .PP \&\s-1META:\s0 if this gets added to core, replace with real documentation. See http://marc.theaimsgroup.com/?l=apache\-modperl&m=112805393100758&w=2 .SH "Special Blocks" .IX Header "Special Blocks" .ie n .SS """BEGIN"" Blocks" .el .SS "\f(CWBEGIN\fP Blocks" .IX Subsection "BEGIN Blocks" \&\f(CW\*(C`BEGIN\*(C'\fR blocks defined in scripts running under the \&\f(CW\*(C`ModPerl::Registry\*(C'\fR handler behave similarly to the normal mod_perl handlers plus: .IP "\(bu" 4 Only once, if pulled in by the parent process via \&\f(CW\*(C`Apache2::RegistryLoader\*(C'\fR. .IP "\(bu" 4 An additional time, once per child process or Perl interpreter, each time the script file changes on disk. .PP \&\f(CW\*(C`BEGIN\*(C'\fR blocks defined in modules loaded from \f(CW\*(C`ModPerl::Registry\*(C'\fR scripts behave identically to the normal mod_perl handlers, regardless of whether they define a package or not. .ie n .SS """CHECK"" and ""INIT"" Blocks" .el .SS "\f(CWCHECK\fP and \f(CWINIT\fP Blocks" .IX Subsection "CHECK and INIT Blocks" Same as normal mod_perl handlers. .ie n .SS """END"" Blocks" .el .SS "\f(CWEND\fP Blocks" .IX Subsection "END Blocks" \&\f(CW\*(C`END\*(C'\fR blocks encountered during compilation of a script, are called after the script has completed its run, including subsequent invocations when the script is cached in memory. This is assuming that the script itself doesn't define a package on its own. If the script defines its own package, the \f(CW\*(C`END\*(C'\fR blocks in the scope of that package will be executed at the end of the interpretor's life. .PP \&\f(CW\*(C`END\*(C'\fR blocks residing in modules loaded by registry script will be executed only once, when the interpreter exits. .SH "Security" .IX Header "Security" \&\f(CW\*(C`ModPerl::Registry::handler\*(C'\fR performs the same sanity checks as mod_cgi does, before running the script. .SH "Environment" .IX Header "Environment" The Apache function `exit' overrides the Perl core built-in function. .SH "Commandline Switches In First Line" .IX Header "Commandline Switches In First Line" Normally when a Perl script is run from the command line or under \s-1CGI,\s0 arguments on the `#!' line are passed to the perl interpreter for processing. .PP \&\f(CW\*(C`ModPerl::Registry\*(C'\fR currently only honors the \fB\-w\fR switch and will enable the \f(CW\*(C`warnings\*(C'\fR pragma in such case. .PP Another common switch used with \s-1CGI\s0 scripts is \fB\-T\fR to turn on taint checking. This can only be enabled when the server starts with the configuration directive: .PP .Vb 1 \& PerlSwitches \-T .Ve .PP However, if taint checking is not enabled, but the \fB\-T\fR switch is seen, \f(CW\*(C`ModPerl::Registry\*(C'\fR will write a warning to the \fIerror_log\fR file. .SH "Debugging" .IX Header "Debugging" You may set the debug level with the \f(CW$ModPerl::Registry::Debug\fR bitmask .PP .Vb 3 \& 1 => log recompile in errorlog \& 2 => ModPerl::Debug::dump in case of $@ \& 4 => trace pedantically .Ve .SH "Caveats" .IX Header "Caveats" ModPerl::Registry makes things look just the \s-1CGI\s0 environment, however, you must understand that this *is not CGI*. Each httpd child will compile your script into memory and keep it there, whereas \s-1CGI\s0 will run it once, cleaning out the entire process space. Many times you have heard "always use \f(CW\*(C`\-w\*(C'\fR, always use \f(CW\*(C`\-w\*(C'\fR and 'use strict'". This is more important here than anywhere else! Some other important caveats to keep in mind are discussed on the Perl Reference page. .SH "Authors" .IX Header "Authors" Andreas J. Koenig, Doug MacEachern and Stas Bekman. .SH "See Also" .IX Header "See Also" \&\f(CW\*(C`ModPerl::RegistryCooker\*(C'\fR, \&\f(CW\*(C`ModPerl::RegistryBB\*(C'\fR and \&\f(CW\*(C`ModPerl::PerlRun\*(C'\fR.