This file is indexed.

/usr/share/doc/libapache2-mod-perl2-doc/docs/2.0/api/ModPerl/RegistryCooker.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<?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>
    <ul>
      <li><a href="#Special-Predefined-Functions">Special Predefined Functions</a></li>
    </ul>
  </li>
  <li><a href="#Sub-classing-Techniques">Sub-classing Techniques</a></li>
  <li><a href="#Examples">Examples</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::RegistryCooker - Cook mod_perl 2.0 Registry Modules</p>

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

<pre><code>  # shouldn&#39;t be used as-is but sub-classed first
  # see ModPerl::Registry for an example</code></pre>

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

<p><code>ModPerl::RegistryCooker</code> is used to create flexible and overridable registry modules which emulate mod_cgi for Perl scripts. The concepts are discussed in the manpage of the following modules: <code><a>ModPerl::Registry</a></code>, <code><a>ModPerl::Registry</a></code> and <code><a>ModPerl::RegistryBB</a></code>.</p>

<p><code>ModPerl::RegistryCooker</code> has two purposes:</p>

<ul>

<li><p>Provide ingredients that can be used by registry sub-classes</p>

</li>
<li><p>Provide a default behavior, which can be overridden in sub-classed</p>

<p>META: in the future this functionality may move into a separate class.</p>

</li>
</ul>

<p>Here are the current overridable methods:</p>

<p>META: these are all documented in RegistryCooker.pm, though not using pod. please help to port these to pod and move the descriptions here.</p>

<ul>

<li><p>new()</p>

<p>create the class&#39;s object, bless it and return it</p>

<pre><code>  my $obj = $class-&gt;new($r);</code></pre>

<p><code>$class</code> -- the registry class, usually <code>__PACKAGE__</code> can be used.</p>

<p><code>$r</code> -- <code>Apache2::Request</code> object.</p>

<p>default: new()</p>

</li>
<li><p>init()</p>

<p>initializes the data object&#39;s fields: <code>REQ</code>, <code>FILENAME</code>, <code>URI</code>. Called from the new().</p>

<p>default: init()</p>

</li>
<li><p>default_handler()</p>

<p>default: default_handler()</p>

</li>
<li><p>run()</p>

<p>default: run()</p>

</li>
<li><p>can_compile()</p>

<p>default: can_compile()</p>

</li>
<li><p>make_namespace()</p>

<p>default: make_namespace()</p>

</li>
<li><p>namespace_root()</p>

<p>default: namespace_root()</p>

</li>
<li><p>namespace_from()</p>

<p>If <code>namespace_from_uri</code> is used and the script is called from the virtual host, by default the virtual host name is prepended to the uri when package name for the compiled script is created. Sometimes this behavior is undesirable, e.g., when the same (physical) script is accessed using the same path_info but different virtual hosts. In that case you can make the script compiled only once for all vhosts, by specifying:</p>

<pre><code>  $ModPerl::RegistryCooker::NameWithVirtualHost = 0;</code></pre>

<p>The drawback is that it affects the global environment and all other scripts will be compiled ignoring virtual hosts.</p>

<p>default: namespace_from()</p>

</li>
<li><p>is_cached()</p>

<p>default: is_cached()</p>

</li>
<li><p>should_compile()</p>

<p>default: should_compile()</p>

</li>
<li><p>flush_namespace()</p>

<p>default: flush_namespace()</p>

</li>
<li><p>cache_table()</p>

<p>default: cache_table()</p>

</li>
<li><p>cache_it()</p>

<p>default: cache_it()</p>

</li>
<li><p>read_script()</p>

<p>default: read_script()</p>

</li>
<li><p>shebang_to_perl()</p>

<p>default: shebang_to_perl()</p>

</li>
<li><p>get_script_name()</p>

<p>default: get_script_name()</p>

</li>
<li><p>chdir_file()</p>

<p>default: chdir_file()</p>

</li>
<li><p>get_mark_line()</p>

<p>default: get_mark_line()</p>

</li>
<li><p>compile()</p>

<p>default: compile()</p>

</li>
<li><p>error_check()</p>

<p>default: error_check()</p>

</li>
<li><p>strip_end_data_segment()</p>

<p>default: strip_end_data_segment()</p>

</li>
<li><p>convert_script_to_compiled_handler()</p>

<p>default: convert_script_to_compiled_handler()</p>

</li>
</ul>

<h2 id="Special-Predefined-Functions">Special Predefined Functions</h2>

<p>The following functions are implemented as constants.</p>

<ul>

<li><p>NOP()</p>

<p>Use when the function shouldn&#39;t do anything.</p>

</li>
<li><p>TRUE()</p>

<p>Use when a function should always return a true value.</p>

</li>
<li><p>FALSE()</p>

<p>Use when a function should always return a false value.</p>

</li>
</ul>

<h1 id="Sub-classing-Techniques">Sub-classing Techniques</h1>

<p>To override the default <code>ModPerl::RegistryCooker</code> methods, first, sub-class <code>ModPerl::RegistryCooker</code> or one of its existing sub-classes, using <code>use base</code>. Second, override the methods.</p>

<p>Those methods that weren&#39;t overridden will be resolved at run time when used for the first time and cached for the future requests. One way to to shortcut this first run resolution is to use the symbol aliasing feature. For example to alias <code>ModPerl::MyRegistry::flush_namespace</code> as <code>ModPerl::RegistryCooker::flush_namespace</code>, you can do:</p>

<pre><code>  package ModPerl::MyRegistry;
  use base qw(ModPerl::RegistryCooker);
  *ModPerl::MyRegistry::flush_namespace =
      \&amp;ModPerl::RegistryCooker::flush_namespace;
  1;</code></pre>

<p>In fact, it&#39;s a good idea to explicitly alias all the methods so you know exactly what functions are used, rather then relying on the defaults. For that purpose <code>ModPerl::RegistryCooker</code> class method install_aliases() can be used. Simply prepare a hash with method names in the current package as keys and corresponding fully qualified methods to be aliased for as values and pass it to install_aliases(). Continuing our example we could do:</p>

<pre><code>  package ModPerl::MyRegistry;
  use base qw(ModPerl::RegistryCooker);
  my %aliases = (
      flush_namespace =&gt; &#39;ModPerl::RegistryCooker::flush_namespace&#39;,
  );
  __PACKAGE__-&gt;install_aliases(\%aliases);
  1;</code></pre>

<p>The values use fully qualified packages so you can mix methods from different classes.</p>

<h1 id="Examples">Examples</h1>

<p>The best examples are existing core registry modules: <code><a>ModPerl::Registry</a></code>, <code><a>ModPerl::Registry</a></code> and <code><a>ModPerl::RegistryBB</a></code>. Look at the source code and their manpages to see how they subclass <code>ModPerl::RegistryCooker</code>.</p>

<p>For example by default <code><a>ModPerl::Registry</a></code> uses the script&#39;s path when creating a package&#39;s namespace. If for example you want to use a uri instead you can override it with:</p>

<pre><code>  *ModPerl::MyRegistry::namespace_from =
      \&amp;ModPerl::RegistryCooker::namespace_from_uri;
  1;</code></pre>

<p>Since the <code>namespace_from_uri</code> component already exists in <code>ModPerl::RegistryCooker</code>. If you want to write your own method, e.g., that creates a namespace based on the inode, you can do:</p>

<pre><code>  sub namespace_from_inode {
      my $self = shift;
      return (stat $self-&gt;[FILENAME])[1];
  }</code></pre>

<p>META: when $r-&gt;finfo will be ported it&#39;ll be more effecient. (stat $r-&gt;finfo)[1]</p>

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

<p>Doug MacEachern</p>

<p>Stas Bekman</p>

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

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


</body>

</html>