The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<html>
<head>
  <link rel="stylesheet" type="text/css" href="dox.css" />
  <title>libapreq2-2.12: libapreq2: APR::Request::Cookie</title> 
</head>
<body>
<div id="page-header">
<p class="menu">
   <a href="http://www.apache.org/">Apache Software Foundation</a> &gt; <a href="http://httpd.apache.org">HTTP Server Project</a> &gt;
<a href="http://httpd.apache.org/apreq/">Request Library Subproject</a></p>
<p class="apache">Apache HTTP Server Request Library</p>
<img alt="" src="feather.gif" /></div>
<!-- Generated by Doxygen 1.5.2 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    <li><a href="examples.html"><span>Examples</span></a></li>
  </ul>
</div>
<h1>APR::Request::Cookie<br>
<small>
[<a class="el" href="group__apreq__xs.html">Perl</a>]</small>
</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
</table>



<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->


<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#overloads">OVERLOADS</a></li>
	<ul>

		<li><a href="#">``''</a></li>
	</ul>

	<li><a href="#methods">METHODS</a></li>
	<ul>

		<li><a href="#new">new</a></li>
		<li><a href="#freeze">freeze</a></li>
		<li><a href="#thaw">thaw</a></li>
		<li><a href="#name">name</a></li>
		<li><a href="#value">value</a></li>
		<li><a href="#secure">secure</a></li>
		<li><a href="#version">version</a></li>
		<li><a href="#path">path</a></li>
		<li><a href="#domain">domain</a></li>
		<li><a href="#port">port</a></li>
		<li><a href="#comment">comment</a></li>
		<li><a href="#commenturl">commentURL</a></li>
		<li><a href="#is_tainted">is_tainted</a></li>
		<li><a href="#make">make</a></li>
		<li><a href="#as_string">as_string</a></li>
	</ul>

	<li><a href="#subroutines">SUBROUTINES</a></li>
	<ul>

		<li><a href="#expires">expires</a></li>
	</ul>

	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#copyright">COPYRIGHT</a></li>
</ul>

<!-- INDEX END -->


<hr />

<p>

</p>

<h1><a name="name">NAME</a></h1>

<p>APR::Request::Cookie - wrapper for libapreq2's cookie API.</p>

<p>

</p>
<hr />

<h1><a name="synopsis">SYNOPSIS</a></h1>

<pre>
  use APR::Request::Cookie;</pre>

<pre>
  # fetch inbound cookie
  $jar = $req-&gt;jar;
  $cookie1 = $jar-&gt;get(&quot;cookie1&quot;);</pre>

<pre>
  # generate new cookie
  $cookie = APR::Request::Cookie-&gt;new($req-&gt;pool,
                                      name =&gt; &quot;foo&quot;,
                                     value =&gt; &quot;bar&quot;,
                                    domain =&gt; &quot;capricorn.com&quot;);
  print &quot;$cookie&quot;; # prints &quot;bar&quot;</pre>

<pre>
  $cookie-&gt;domain(&quot;example.com&quot;); # change domains
  $cookie-&gt;version(1); # upgrade it to conform with RFC 2109/2965.</pre>

<pre>
  # send a response header
  print sprintf &quot;Set-Cookie: %s\n&quot;, $cookie-&gt;as_string;</pre>

<p>

</p>
<hr />

<h1><a name="description">DESCRIPTION</a></h1>

<p>The APR::Request::Cookie module provides base methods
for interfacing with libapreq2's cookie API.  It also provides
a few utility functions and constants.</p>

<p>This manpage documents version 2.12
of the APR::Request::Cookie package.</p>

<p>

</p>
<hr />

<h1><a name="overloads">OVERLOADS</a></h1>

<p>APR::Request::Cookie</p>

<p>

</p>

<h2><a name="">``''</a></h2>

<pre>
    &quot;$cookie&quot;</pre>

<p>The double-quote interpolation operator maps to
<code>APR::Request::Cookie::value()</code>.</p>

<pre>
    ok &quot;$cookie&quot; eq $cookie-&gt;value;</pre>

<p>

</p>
<hr />

<h1><a name="methods">METHODS</a></h1>

<p>APR::Request::Cookie</p>

<p>

</p>

<h2><a name="new">new</a></h2>

<pre>
    APR::Request::Cookie-&gt;new($pool,
                               name =&gt; $name,
                              value =&gt; $value,
                              %args)</pre>

<p>Creates a new cookie.  Here <code>$pool</code> is an APR::Pool object,
and <code>$name</code> is the cookie's name. The <code>$value</code> is transformed
into the cookie's raw value through the class' <code>freeze()</code> method.
The remaining arguments are optional:</p>

<dl>

<dt>
<strong>
<a name="item__2dsecure">-secure</a>
</strong><br />

</dt>


<dt>
<strong>
<a name="item__2dversion">-version</a>
</strong><br />

</dt>


<dt>
<strong>
<a name="item__2dpath">-path</a>
</strong><br />

</dt>


<dt>
<strong>
<a name="item__2ddomain">-domain</a>
</strong><br />

</dt>


<dt>
<strong>
<a name="item__2dport">-port</a>
</strong><br />

</dt>


<dt>
<strong>
<a name="item__2dexpires">-expires</a>
</strong><br />

</dt>


<dt>
<strong>
<a name="item__2dcomment">-comment</a>
</strong><br />

</dt>


<dt>
<strong>
<a name="item__2dcommenturl">-commentURL</a>
</strong><br />

</dt>


</dl>


<p>For details on these arguments, please consult
the corresponding method's documentation.</p>

<p>

</p>

<h2><a name="freeze">freeze</a></h2>

<pre>
    APR::Request::Cookie-&gt;freeze($value)</pre>

<p>Class method representing the default serializer;
here it returns $value unmodified.</p>

<pre>
    ok &quot;foo&quot; eq APR::Request::Cookie-&gt;freeze(&quot;foo&quot;);</pre>

<p>

</p>

<h2><a name="thaw">thaw</a></h2>

<pre>
    $cookie-&gt;thaw()</pre>

<p>Reverses <code>freeze()</code>; here it simply returns 
$cookie-&gt;value since <code>freeze()</code> is a noop.</p>

<pre>
    ok $cookie-&gt;thaw eq $cookie-&gt;value;</pre>

<p>

</p>

<h2><a name="name">name</a></h2>

<pre>
    $cookie-&gt;name()</pre>

<p>Fetch the cookie's name.  This attribute
cannot be modified and is never serialized;
ie <code>freeze()</code> and <code>thaw()</code> do not act on the
cookie's name.</p>

<p>

</p>

<h2><a name="value">value</a></h2>

<pre>
    $cookie-&gt;value()</pre>

<p>Fetch the cookie's raw (frozen) value.
This attribute cannot be modified.</p>

<p>

</p>

<h2><a name="secure">secure</a></h2>

<pre>
    $cookie-&gt;secure()
    $cookie-&gt;secure($set)</pre>

<p>Get/set the cookie's secure flag.</p>

<pre>
    $cookie-&gt;secure(1);
    ok $cookie-&gt;secure == 1;</pre>

<p>

</p>

<h2><a name="version">version</a></h2>

<pre>
    $cookie-&gt;version()
    $cookie-&gt;version($set)</pre>

<p>Get/set the cookie's version number.
Version 0 cookies conform to the Netscape
spec; Version 1 cookies conform to either
RFC 2109 or RFC 2965.</p>

<pre>
    $version = $cookie-&gt;version;
    $cookie-&gt;version(1);
    ok $cookie-&gt;version == 1;</pre>

<p>

</p>

<h2><a name="path">path</a></h2>

<pre>
    $cookie-&gt;path()
    $cookie-&gt;path($set)</pre>

<p>Get/set the cookie's path string.</p>

<pre>
    $path = $cookie-&gt;path;
    $cookie-&gt;path(&quot;/1/2/3/4&quot;);
    ok $cookie-&gt;path eq &quot;/1/2/3/4&quot;;</pre>

<p>

</p>

<h2><a name="domain">domain</a></h2>

<pre>
    $cookie-&gt;domain()
    $cookie-&gt;domain($set)</pre>

<p>Get/set the cookie's domain string.</p>

<pre>
    $domain = $cookie-&gt;domain;
    $cookie-&gt;domain(&quot;apache.org&quot;);
    ok $cookie-&gt;domain eq &quot;apache.org&quot;;</pre>

<p>

</p>

<h2><a name="port">port</a></h2>

<pre>
    $cookie-&gt;port()
    $cookie-&gt;port($set)</pre>

<p>Get/set the cookie's port string.
Only valid for Version 1 cookies.</p>

<pre>
    $port = $cookie-&gt;port;
    $cookie-&gt;port(8888);
    ok $cookie-&gt;port == 8888;</pre>

<p>

</p>

<h2><a name="comment">comment</a></h2>

<pre>
    $cookie-&gt;comment()
    $cookie-&gt;comment($set)</pre>

<p>Get/set the cookie's comment string.
Only valid for Version 1 cookies.</p>

<pre>
    $comment = $cookie-&gt;comment;
    $cookie-&gt;comment(&quot;quux&quot;);
    ok $cookie-&gt;comment eq &quot;quux&quot;;</pre>

<p>

</p>

<h2><a name="commenturl">commentURL</a></h2>

<pre>
    $cookie-&gt;commentURL()
    $cookie-&gt;commentURL($set)</pre>

<p>Get/set the cookie's commentURL string.
Only valid for Version 1 cookies.</p>

<pre>
    $commentURL = $cookie-&gt;commentURL;
    $cookie-&gt;commentURL(&quot;/foo/bar&quot;);
    ok $cookie-&gt;commentURL eq &quot;/foo/bar&quot;;</pre>

<p>

</p>

<h2><a name="is_tainted">is_tainted</a></h2>

<pre>
    $cookie-&gt;is_tainted()
    $cookie-&gt;is_tainted($set)</pre>

<p>Get/set the cookie's internal tainted flag.</p>

<pre>
    $tainted = $cookie-&gt;is_tainted;
    $cookie-&gt;is_tainted(1);
    ok $cookie-&gt;is_tainted == 1;</pre>

<p>

</p>

<h2><a name="make">make</a></h2>

<pre>
    APR::Request::Cookie-&gt;make($pool, $name, $value)</pre>

<p>Fast XS cookie constructor invoked by <code>new()</code>.
The cookie's raw name &amp; value are taken directly from the
passed in arguments; no freezing/encoding is done on the $value.</p>

<p>

</p>

<h2><a name="as_string">as_string</a></h2>

<pre>
    $cookie-&gt;as_string()</pre>

<p>String representation of the cookie, suitable for inclusion
in a ``Set-Cookie'' header.</p>

<pre>
    print &quot;Set-Cookie: &quot;, $cookie-&gt;as_string, &quot;\n&quot;;</pre>

<p>

</p>
<hr />

<h1><a name="subroutines">SUBROUTINES</a></h1>

<pre>
  APR::Request::Cookie</pre>

<p>

</p>

<h2><a name="expires">expires</a></h2>

<pre>
  expires($date_string)</pre>

<p>

</p>
<hr />

<h1><a name="see_also">SEE ALSO</a></h1>

<p><a href="group__apreq__xs__cookie.html">the Apache2::Cookie manpage</a>, <a href="group__apreq__xs__apr__request.html">the APR::Request manpage</a>.</p>

<p>

</p>
<hr />

<h1><a name="copyright">COPYRIGHT</a></h1>

<pre>
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the &quot;License&quot;); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at</pre>

<pre>
      <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></pre>

<pre>
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.</pre>


 <div id="footer">
<p class="apache">
Copyright &copy; 2003-2006 <a href="http://www.apache.org">The Apache Software Foundation</a>.<br/>
See <a href="apreq_license.html">LICENSE</a>.</p>
<p class="menu">
<span style="color:#aaa">page generated by <a href="http://www.doxygen.org/"><code>doxygen</code></a>
version 1.5.2 on 6 Mar 2009</span>
</p>
</div>
</body>
</html>