This file is indexed.

/usr/share/doc/libapache2-mod-perl2-doc/docs/2.0/api/ModPerl/Registry.html is in libapache2-mod-perl2-doc 2.0.8+httpd24-r1449661-6ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body style="background-color: white">



<ul id="index">
  <li><a href="#NAME">NAME</a></li>
  <li><a href="#Synopsis">Synopsis</a></li>
  <li><a href="#Description">Description</a></li>
  <li><a href="#DirectoryIndex">DirectoryIndex</a></li>
  <li><a href="#Special-Blocks">Special Blocks</a>
    <ul>
      <li><a href="#BEGIN-Blocks">BEGIN Blocks</a></li>
      <li><a href="#CHECK-and-INIT-Blocks">CHECK and INIT Blocks</a></li>
      <li><a href="#END-Blocks">END Blocks</a></li>
    </ul>
  </li>
  <li><a href="#Security">Security</a></li>
  <li><a href="#Environment">Environment</a></li>
  <li><a href="#Commandline-Switches-In-First-Line">Commandline Switches In First Line</a></li>
  <li><a href="#Debugging">Debugging</a></li>
  <li><a href="#Caveats">Caveats</a></li>
  <li><a href="#Authors">Authors</a></li>
  <li><a href="#See-Also">See Also</a></li>
</ul>

<h1 id="NAME">NAME</h1>

<p>ModPerl::Registry - Run unaltered CGI scripts persistently under mod_perl</p>

<h1 id="Synopsis">Synopsis</h1>

<pre><code>  # httpd.conf
  PerlModule ModPerl::Registry
  Alias /perl/ /home/httpd/perl/
  &lt;Location /perl&gt;
      SetHandler perl-script
      PerlResponseHandler ModPerl::Registry
      #PerlOptions +ParseHeaders
      #PerlOptions -GlobalRequest
      Options +ExecCGI
  &lt;/Location&gt;</code></pre>

<h1 id="Description">Description</h1>

<p>URIs in the form of <code>http://example.com/perl/test.pl</code> 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. <i>test.pl</i> in our example) is updated on disk. Think of it as an object oriented server with each script implementing a class loaded at runtime.</p>

<p>The file looks much like a &quot;normal&quot; script, but it is compiled into a subroutine.</p>

<p>For example:</p>

<pre><code>  my $r = Apache2::RequestUtil-&gt;request;
  $r-&gt;content_type(&quot;text/html&quot;);
  $r-&gt;print(&quot;mod_perl rules!&quot;);</code></pre>

<p>XXX: STOPPED here. Below is the old Apache::Registry document which I haven&#39;t worked through yet.</p>

<p>META: document that for now we don&#39;t chdir() into the script&#39;s dir, because it affects the whole process under threads. <code><a>ModPerl::RegistryPrefork</a></code> should be used by those who run only under prefork MPM.</p>

<p>This module emulates the CGI environment, allowing programmers to write scripts that run under CGI or mod_perl without change. Existing CGI scripts may require some changes, simply because a CGI script has a very short lifetime of one HTTP request, allowing you to get away with &quot;quick and dirty&quot; scripting. Using mod_perl and ModPerl::Registry requires you to be more careful, but it also gives new meaning to the word &quot;quick&quot;!</p>

<p>Be sure to read all mod_perl related documentation for more details, including instructions for setting up an environment that looks exactly like CGI:</p>

<pre><code> print &quot;Content-type: text/html\n\n&quot;;
 print &quot;Hi There!&quot;;</code></pre>

<p>Note that each httpd process or &quot;child&quot; 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.</p>

<h1 id="DirectoryIndex">DirectoryIndex</h1>

<p>If you are trying setup a DirectoryIndex under a Location covered by ModPerl::Registry* you might run into some trouble.</p>

<p>META: if this gets added to core, replace with real documenation. See http://marc.theaimsgroup.com/?l=apache-modperl&amp;m=112805393100758&amp;w=2</p>

<h1 id="Special-Blocks">Special Blocks</h1>

<h2 id="BEGIN-Blocks"><code>BEGIN</code> Blocks</h2>

<p><code>BEGIN</code> blocks defined in scripts running under the <code>ModPerl::Registry</code> handler behave similarly to the normal <a>mod_perl handlers</a> plus:</p>

<ul>

<li><p>Only once, if pulled in by the parent process via <code>Apache2::RegistryLoader</code>.</p>

</li>
<li><p>An additional time, once per child process or Perl interpreter, each time the script file changes on disk.</p>

</li>
</ul>

<p><code>BEGIN</code> blocks defined in modules loaded from <code>ModPerl::Registry</code> scripts behave identically to the normal <a>mod_perl handlers</a>, regardless of whether they define a package or not.</p>

<h2 id="CHECK-and-INIT-Blocks"><code>CHECK</code> and <code>INIT</code> Blocks</h2>

<p>Same as normal <a>mod_perl handlers</a>.</p>

<h2 id="END-Blocks"><code>END</code> Blocks</h2>

<p><code>END</code> 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&#39;t define a package on its own. If the script defines its own package, the <code>END</code> blocks in the scope of that package will be executed at the end of the interpretor&#39;s life.</p>

<p><code>END</code> blocks residing in modules loaded by registry script will be executed only once, when the interpreter exits.</p>

<h1 id="Security">Security</h1>

<p><code>ModPerl::Registry::handler</code> performs the same sanity checks as mod_cgi does, before running the script.</p>

<h1 id="Environment">Environment</h1>

<p>The Apache function `exit&#39; overrides the Perl core built-in function.</p>

<h1 id="Commandline-Switches-In-First-Line">Commandline Switches In First Line</h1>

<p>Normally when a Perl script is run from the command line or under CGI, arguments on the `#!&#39; line are passed to the perl interpreter for processing.</p>

<p><code>ModPerl::Registry</code> currently only honors the <b>-w</b> switch and will enable the <code>warnings</code> pragma in such case.</p>

<p>Another common switch used with CGI scripts is <b>-T</b> to turn on taint checking. This can only be enabled when the server starts with the configuration directive:</p>

<pre><code> PerlSwitches -T</code></pre>

<p>However, if taint checking is not enabled, but the <b>-T</b> switch is seen, <code>ModPerl::Registry</code> will write a warning to the <i>error_log</i> file.</p>

<h1 id="Debugging">Debugging</h1>

<p>You may set the debug level with the $ModPerl::Registry::Debug bitmask</p>

<pre><code> 1 =&gt; log recompile in errorlog
 2 =&gt; ModPerl::Debug::dump in case of $@
 4 =&gt; trace pedantically</code></pre>

<h1 id="Caveats">Caveats</h1>

<p>ModPerl::Registry makes things look just the CGI environment, however, you must understand that this *is not CGI*. Each httpd child will compile your script into memory and keep it there, whereas CGI will run it once, cleaning out the entire process space. Many times you have heard &quot;always use <code>-w</code>, always use <code>-w</code> and &#39;use strict&#39;&quot;. This is more important here than anywhere else! Some other important caveats to keep in mind are discussed on the <a>Perl Reference</a> page.</p>

<h1 id="Authors">Authors</h1>

<p>Andreas J. Koenig, Doug MacEachern and Stas Bekman.</p>

<h1 id="See-Also">See Also</h1>

<p><code><a>ModPerl::RegistryCooker</a></code>, <code><a>ModPerl::RegistryBB</a></code> and <code><a>ModPerl::PerlRun</a></code>.</p>


</body>

</html>