/usr/share/doc/libapache2-mod-perl2-doc/docs/2.0/user/coding/cooking.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 | <?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="#Description">Description</a></li>
<li><a href="#Sending-Cookies-in-REDIRECT-Response-ModPerl::Registry">Sending Cookies in REDIRECT Response (ModPerl::Registry)</a></li>
<li><a href="#Sending-Cookies-in-REDIRECT-Response-handlers">Sending Cookies in REDIRECT Response (handlers)</a></li>
<li><a href="#Sending-Cookies-Using-libapreq2">Sending Cookies Using libapreq2</a></li>
<li><a href="#Maintainers">Maintainers</a></li>
<li><a href="#Authors">Authors</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>Cooking Recipes</p>
<h1 id="Description">Description</h1>
<p>As the chapter's title implies, here you will find ready-to-go mod_perl 2.0 recipes.</p>
<p>If you know a useful recipe, not yet listed here, please post it to <a>the mod_perl mailing list</a> and we will add it here.</p>
<h1 id="Sending-Cookies-in-REDIRECT-Response-ModPerl::Registry">Sending Cookies in REDIRECT Response (ModPerl::Registry)</h1>
<pre><code> use CGI::Cookie ();
use Apache2::RequestRec ();
use APR::Table ();
use Apache2::Const -compile => qw(REDIRECT);
my $location = "http://example.com/final_destination/";
sub handler {
my $r = shift;
my $cookie = CGI::Cookie->new(-name => 'mod_perl',
-value => 'awesome');
$r->err_headers_out->add('Set-Cookie' => $cookie);
$r->headers_out->set(Location => $location);
$r->status(Apache2::Const::REDIRECT);
return Apache2::Const::REDIRECT;
}
1;</code></pre>
<h1 id="Sending-Cookies-in-REDIRECT-Response-handlers">Sending Cookies in REDIRECT Response (handlers)</h1>
<pre><code> use CGI::Cookie ();
use Apache2::RequestRec ();
use APR::Table ();
use Apache2::Const -compile => qw(REDIRECT);
my $location = "http://example.com/final_destination/";
sub handler {
my $r = shift;
my $cookie = CGI::Cookie->new(-name => 'mod_perl',
-value => 'awesome');
$r->err_headers_out->add('Set-Cookie' => $cookie);
$r->headers_out->set(Location => $location);
return Apache2::Const::REDIRECT;
}
1;</code></pre>
<p>note that this example differs from the Registry example only in that it does not attempt to fiddle with <code>$r->status()</code> - <code>ModPerl::Registry</code> uses <code>$r->status()</code> as a hack, but handlers should never manipulate the status field in the request record.</p>
<h1 id="Sending-Cookies-Using-libapreq2">Sending Cookies Using libapreq2</h1>
<pre><code> use Apache2::Request ();
use Apache2::RequestRec ();
use Apache2::Const -compile => qw(OK);
use APR::Table ();
use APR::Request::Cookie ();
sub handler {
my $r = shift;
my $req = $r->pool();
my $cookie = APR::Request::Cookie->new($req, name => "foo", value => time(), path => '/cookie');
$r->err_headers_out->add('Set-Cookie' => $cookie->as_string);
$r->content_type("text/plain");
$r->print("Testing....");
return Apache2::Const::OK;
}</code></pre>
<h1 id="Maintainers">Maintainers</h1>
<p>Maintainer is the person(s) you should contact with updates, corrections and patches.</p>
<ul>
<li><p>Stas Bekman [http://stason.org/]</p>
</li>
</ul>
<h1 id="Authors">Authors</h1>
<ul>
<li><p>Stas Bekman [http://stason.org/]</p>
</li>
</ul>
<p>Only the major authors are listed above. For contributors see the Changes file.</p>
</body>
</html>
|