/usr/share/doc/libapache2-mod-perl2-doc/docs/2.0/api/Apache2/CmdParms.html is in libapache2-mod-perl2-doc 2.0.9~1624218-2+deb8u2.
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 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | <?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>
<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="#API">API</a>
<ul>
<li><a href="#add_config">add_config</a></li>
<li><a href="#check_cmd_context">check_cmd_context</a></li>
<li><a href="#cmd">cmd</a></li>
<li><a href="#directive">directive</a></li>
<li><a href="#info">info</a></li>
<li><a href="#method_is_limited">method_is_limited</a></li>
<li><a href="#override">override</a></li>
<li><a href="#override_opts">override_opts</a></li>
<li><a href="#path">path</a></li>
<li><a href="#pool">pool</a></li>
<li><a href="#server">server</a></li>
<li><a href="#temp_pool">temp_pool</a></li>
</ul>
</li>
<li><a href="#Unsupported-API">Unsupported API</a>
<ul>
<li><a href="#context">context</a></li>
</ul>
</li>
<li><a href="#See-Also">See Also</a></li>
<li><a href="#Copyright">Copyright</a></li>
<li><a href="#Authors">Authors</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>Apache2::CmdParms - Perl API for Apache command parameters object</p>
<h1 id="Synopsis">Synopsis</h1>
<pre><code> use Apache2::CmdParms ();
use Apache2::Module ();
use Apache2::Const -compile => qw(NOT_IN_LOCATION);
my @directives = (
{
name => 'MyDirective',
cmd_data => 'some extra data',
},
);
Apache2::Module::add(__PACKAGE__, \@directives);
sub MyDirective {
my ($self, $parms, $args) = @_;
# push config
$parms->add_config(['ServerTokens off']);
# this command's command object
$cmd = $parms->cmd;
# check the current command's context
$error = $parms->check_cmd_context(Apache2::Const::NOT_IN_LOCATION);
# this command's context
$context = $parms->context;
# this command's directive object
$directive = $parms->directive;
# the extra information passed thru cmd_data to
# Apache2::Module::add()
$info = $parms->info;
# which methods are <Limit>ed ?
$is_limited = $parms->method_is_limited('GET');
# which allow-override bits are set
$override = $parms->override;
# which Options are allowed by AllowOverride (since Apache 2.2)
$override = $parms->override_opts;
# the path this command is being invoked in
$path = $parms->path;
# this command's pool
$p = $parms->pool;
# this command's configuration time pool
$p = $parms->temp_pool;
}</code></pre>
<h1 id="Description">Description</h1>
<p><code>Apache2::CmdParms</code> provides the Perl API for Apache command parameters object.</p>
<h1 id="API">API</h1>
<p><code>Apache2::CmdParms</code> provides the following functions and/or methods:</p>
<h2 id="add_config"><code>add_config</code></h2>
<p>Dynamically add Apache configuration at request processing runtime:</p>
<pre><code> $parms->add_config($lines);</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="arg1:-lines-ARRAY-ref">arg1: <code>$lines</code> (ARRAY ref)</dt>
<dd>
<p>An ARRAY reference containing configuration lines per element, without the new line terminators.</p>
</dd>
<dt id="ret:-no-return-value">ret: no return value</dt>
<dd>
</dd>
<dt id="since:-2.0.00">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>See also: <code><a>$s->add_config</a></code>, <code><a>$r->add_config</a></code></p>
<h2 id="check_cmd_context"><code>check_cmd_context</code></h2>
<p>Check the current command against a context bitmask of forbidden contexts.</p>
<pre><code> $error = $parms->check_cmd_context($check);</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object1">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="arg1:-check-Apache2::Const-:context-constant">arg1: <code>$check</code> ( <code><a>Apache2::Const :context constant</a></code> )</dt>
<dd>
<p>the context to check against.</p>
</dd>
<dt id="ret:-error-string-undef">ret: <code>$error</code> ( string / undef )</dt>
<dd>
<p>If the context is forbidden, this method returns a textual description of why it was forbidden. If the context is permitted, this method returns <code>undef</code>.</p>
</dd>
<dt id="since:-2.0.001">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>For example here is how to check whether a command is allowed in the <code><Location></code> container:</p>
<pre><code> use Apache2::Const -compile qw(NOT_IN_LOCATION);
if (my $error = $parms->check_cmd_context(Apache2::Const::NOT_IN_LOCATION)) {
die "directive ... not allowed in <Location> context"
}</code></pre>
<h2 id="cmd"><code>cmd</code></h2>
<p>This module's command information</p>
<pre><code> $cmd = $parms->cmd();</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object2">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-cmd-Apache2::Command-object">ret: <code>$cmd</code> ( <code><a>Apache2::Command object</a></code> )</dt>
<dd>
</dd>
<dt id="since:-2.0.002">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<h2 id="directive"><code>directive</code></h2>
<p>This command's directive object in the configuration tree</p>
<pre><code> $directive = $parms->directive;</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object3">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-directive-Apache2::Directive-object">ret: <code>$directive</code> ( <code><a>Apache2::Directive object</a></code> )</dt>
<dd>
<p>The current directive node in the configuration tree</p>
</dd>
<dt id="since:-2.0.003">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<h2 id="info"><code>info</code></h2>
<p>The extra information passed through <code>cmd_data</code> in <code><a>Apache2::Module::add()</a></code>.</p>
<pre><code> $info = $parms->info;</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object4">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-info-string">ret: <code>$info</code> ( string )</dt>
<dd>
<p>The string passed in <code>cmd_data</code></p>
</dd>
<dt id="since:-2.0.004">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>For example here is how to pass arbitrary information to a directive subroutine:</p>
<pre><code> my @directives = (
{
name => 'MyDirective1',
func => \&MyDirective,
cmd_data => 'One',
},
{
name => 'MyDirective2',
func => \&MyDirective,
cmd_data => 'Two',
},
);
Apache2::Module::add(__PACKAGE__, \@directives);
sub MyDirective {
my ($self, $parms, $args) = @_;
my $info = $parms->info;
}</code></pre>
<p>In this example <code>$info</code> will either be <code>'One'</code> or <code>'Two'</code> depending on whether the directive was called as <i>MyDirective1</i> or <i>MyDirective2</i>.</p>
<h2 id="method_is_limited"><code>method_is_limited</code></h2>
<p>Discover if a method is <Limit>ed in the current scope</p>
<pre><code> $is_limited = $parms->method_is_limited($method);</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object5">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="arg1:-method-string">arg1: <code>$method</code> (string)</dt>
<dd>
<p>The name of the method to check for</p>
</dd>
<dt id="ret:-is_limited-boolean">ret: <code>$is_limited</code> ( boolean )</dt>
<dd>
</dd>
<dt id="since:-2.0.005">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>For example, to check if the <code>GET</code> method is being <code><Limit></code>ed in the current scope, do:</p>
<pre><code> if ($parms->method_is_limited('GET') {
die "...";
}</code></pre>
<h2 id="override"><code>override</code></h2>
<p>Which allow-override bits are set (<code>AllowOverride</code> directive)</p>
<pre><code> $override = $parms->override;</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object6">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-override-bitmask">ret: <code>$override</code> ( bitmask )</dt>
<dd>
<p>the allow-override bits bitmask, which can be tested against <code><a>Apache2::Const :override constants</a></code>.</p>
</dd>
<dt id="since:-2.0.006">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>For example to check that the <code>AllowOverride</code>'s <code>AuthConfig</code> and <code>FileInfo</code> options are enabled for this command, do:</p>
<pre><code> use Apache2::Const -compile qw(:override);
$wanted = Apache2::Const::OR_AUTHCFG | Apache2::Const::OR_FILEINFO;
$masked = $parms->override & $wanted;
unless ($wanted == $masked) {
die "...";
}</code></pre>
<h2 id="override_opts"><code>override_opts</code></h2>
<p>Which options are allowed to be overridden by <code>.htaccess</code> files. This is set by <code>AllowOverride Options=...</code>.</p>
<pre><code> $override_opts = $parms->override_opts;</code></pre>
<p>Enabling single options was introduced with Apache 2.2. For Apache 2.0 this function simply returns a bitmask with all options allowed.</p>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object7">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-override_opts-bitmask">ret: <code>$override_opts</code> ( bitmask )</dt>
<dd>
<p>the bitmask, which can be tested against <code><a>Apache2::Const :options constants</a></code>.</p>
</dd>
<dt id="since:-2.0.3">since: 2.0.3</dt>
<dd>
</dd>
</dl>
<h2 id="path"><code>path</code></h2>
<p>The current pathname/location/match of the block this command is in</p>
<pre><code> $path = $parms->path;</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object8">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-path-string-undef">ret: <code>$path</code> ( string / <code>undef</code> )</dt>
<dd>
<p>If configuring for a block like <Location>, <LocationMatch>, <Directory>, etc., the pathname part of that directive. Otherwise, <code>undef</code> is returned.</p>
</dd>
<dt id="since:-2.0.007">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>For example for a container block:</p>
<pre><code> <Location /foo>
...
</Location></code></pre>
<p><i>'/foo'</i> will be returned.</p>
<h2 id="pool"><code>pool</code></h2>
<p>Pool associated with this command</p>
<pre><code> $p = $parms->pool;</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object9">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-p-APR::Pool-object">ret: <code>$p</code> ( <code><a>APR::Pool object</a></code> )</dt>
<dd>
</dd>
<dt id="since:-2.0.008">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<h2 id="server"><code>server</code></h2>
<p>The (vhost) server this command was defined in <i>httpd.conf</i></p>
<pre><code> $s = $parms->server;</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object10">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-s-Apache2::Server-object">ret: <code>$s</code> ( <code><a>Apache2::Server object</a></code> )</dt>
<dd>
</dd>
<dt id="since:-2.0.009">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<h2 id="temp_pool"><code>temp_pool</code></h2>
<p>Pool for scratch memory; persists during configuration, but destroyed before the first request is served.</p>
<pre><code> $temp_pool = $parms->temp_pool;</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object11">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-temp_pool-APR::Pool-object">ret: <code>$temp_pool</code> ( <code><a>APR::Pool object</a></code> )</dt>
<dd>
</dd>
<dt id="since:-2.0.0010">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>Most likely you shouldn't use this pool object, unless you know what you are doing. Use <code><a href="#C_pool_">$parms->pool</a></code> instead.</p>
<h1 id="Unsupported-API">Unsupported API</h1>
<p><code>Apache2::CmdParms</code> also provides auto-generated Perl interface for a few other methods which aren't tested at the moment and therefore their API is a subject to change. These methods will be finalized later as a need arises. If you want to rely on any of the following methods please contact the <a>the mod_perl development mailing list</a> so we can help each other take the steps necessary to shift the method to an officially supported API.</p>
<h2 id="context"><code>context</code></h2>
<p>Get context containing pointers to modules' per-dir config structures.</p>
<pre><code> $context = $parms->context;</code></pre>
<dl>
<dt id="obj:-parms-Apache2::CmdParms-object12">obj: <code>$parms</code> ( <code><a>Apache2::CmdParms object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-newval-Apache2::ConfVector-object">ret: <code>$newval</code> ( <code><a>Apache2::ConfVector object</a></code> )</dt>
<dd>
<p>Returns the commands' per-dir config structures</p>
</dd>
<dt id="since:-2.0.0011">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<h1 id="See-Also">See Also</h1>
<p><a>mod_perl 2.0 documentation</a>.</p>
<h1 id="Copyright">Copyright</h1>
<p>mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.</p>
<h1 id="Authors">Authors</h1>
<p><a>The mod_perl development team and numerous contributors</a>.</p>
</body>
</html>
|