.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Cookie 3pm" .TH Cookie 3pm "2019-10-02" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" APR::Request::Cookie \- wrapper for libapreq2's cookie API. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use APR::Request::Cookie; \& \& # fetch inbound cookie \& $jar = $req\->jar; \& $cookie1 = $jar\->get("cookie1"); \& \& # generate new cookie \& $cookie = APR::Request::Cookie\->new($req\->pool, \& name => "foo", \& value => "bar", \& domain => "capricorn.com"); \& print "$cookie"; # prints "bar" \& \& $cookie\->domain("example.com"); # change domains \& $cookie\->version(1); # upgrade it to conform with RFC 2109/2965. \& \& # send a response header \& print sprintf "Set\-Cookie: %s\en", $cookie\->as_string; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The APR::Request::Cookie module provides base methods for interfacing with libapreq2's cookie \s-1API.\s0 It also provides a few utility functions and constants. .PP This manpage documents version 2.13 of the APR::Request::Cookie package. .SH "OVERLOADS" .IX Header "OVERLOADS" APR::Request::Cookie .ie n .SS """""" .el .SS "``''" .IX Subsection """""" .Vb 1 \& "$cookie" .Ve .PP The double-quote interpolation operator maps to \&\f(CW\*(C`APR::Request::Cookie::value()\*(C'\fR. .PP .Vb 1 \& ok "$cookie" eq $cookie\->value; .Ve .SH "METHODS" .IX Header "METHODS" APR::Request::Cookie .SS "new" .IX Subsection "new" .Vb 4 \& APR::Request::Cookie\->new($pool, \& name => $name, \& value => $value, \& %args) .Ve .PP Creates a new cookie. Here \f(CW$pool\fR is an APR::Pool object, and \f(CW$name\fR is the cookie's name. The \f(CW$value\fR is transformed into the cookie's raw value through the class' \f(CW\*(C`freeze()\*(C'\fR method. The remaining arguments are optional: .IP "\-secure" 4 .IX Item "-secure" .PD 0 .IP "\-httponly" 4 .IX Item "-httponly" .IP "\-version" 4 .IX Item "-version" .IP "\-path" 4 .IX Item "-path" .IP "\-domain" 4 .IX Item "-domain" .IP "\-port" 4 .IX Item "-port" .IP "\-expires" 4 .IX Item "-expires" .IP "\-comment" 4 .IX Item "-comment" .IP "\-commentURL" 4 .IX Item "-commentURL" .PD .PP For details on these arguments, please consult the corresponding method's documentation. .SS "freeze" .IX Subsection "freeze" .Vb 1 \& APR::Request::Cookie\->freeze($value) .Ve .PP Class method representing the default serializer; here it returns \f(CW$value\fR unmodified. .PP .Vb 1 \& ok "foo" eq APR::Request::Cookie\->freeze("foo"); .Ve .SS "thaw" .IX Subsection "thaw" .Vb 1 \& $cookie\->thaw() .Ve .PP Reverses \f(CW\*(C`freeze()\*(C'\fR; here it simply returns \&\f(CW$cookie\fR\->value since \fBfreeze()\fR is a noop. .PP .Vb 1 \& ok $cookie\->thaw eq $cookie\->value; .Ve .SS "name" .IX Subsection "name" .Vb 1 \& $cookie\->name() .Ve .PP Fetch the cookie's name. This attribute cannot be modified and is never serialized; ie \fBfreeze()\fR and \fBthaw()\fR do not act on the cookie's name. .SS "value" .IX Subsection "value" .Vb 1 \& $cookie\->value() .Ve .PP Fetch the cookie's raw (frozen) value. This attribute cannot be modified. .SS "secure" .IX Subsection "secure" .Vb 2 \& $cookie\->secure() \& $cookie\->secure($set) .Ve .PP Get/set the cookie's secure flag. .PP .Vb 2 \& $cookie\->secure(1); \& ok $cookie\->secure == 1; .Ve .SS "httponly" .IX Subsection "httponly" .Vb 2 \& $cookie\->httponly() \& $cookie\->httponly($set) .Ve .PP Get/set the cookie's HttpOnly flag. .PP .Vb 2 \& $cookie\->httponly(1); \& ok $cookie\->httponly == 1; .Ve .SS "version" .IX Subsection "version" .Vb 2 \& $cookie\->version() \& $cookie\->version($set) .Ve .PP Get/set the cookie's version number. Version 0 cookies conform to the Netscape spec; Version 1 cookies conform to either \&\s-1RFC 2109\s0 or \s-1RFC 2965.\s0 .PP .Vb 3 \& $version = $cookie\->version; \& $cookie\->version(1); \& ok $cookie\->version == 1; .Ve .SS "path" .IX Subsection "path" .Vb 2 \& $cookie\->path() \& $cookie\->path($set) .Ve .PP Get/set the cookie's path string. .PP .Vb 3 \& $path = $cookie\->path; \& $cookie\->path("/1/2/3/4"); \& ok $cookie\->path eq "/1/2/3/4"; .Ve .SS "domain" .IX Subsection "domain" .Vb 2 \& $cookie\->domain() \& $cookie\->domain($set) .Ve .PP Get/set the cookie's domain string. .PP .Vb 3 \& $domain = $cookie\->domain; \& $cookie\->domain("apache.org"); \& ok $cookie\->domain eq "apache.org"; .Ve .SS "port" .IX Subsection "port" .Vb 2 \& $cookie\->port() \& $cookie\->port($set) .Ve .PP Get/set the cookie's port string. Only valid for Version 1 cookies. .PP .Vb 3 \& $port = $cookie\->port; \& $cookie\->port(8888); \& ok $cookie\->port == 8888; .Ve .SS "comment" .IX Subsection "comment" .Vb 2 \& $cookie\->comment() \& $cookie\->comment($set) .Ve .PP Get/set the cookie's comment string. Only valid for Version 1 cookies. .PP .Vb 3 \& $comment = $cookie\->comment; \& $cookie\->comment("quux"); \& ok $cookie\->comment eq "quux"; .Ve .SS "commentURL" .IX Subsection "commentURL" .Vb 2 \& $cookie\->commentURL() \& $cookie\->commentURL($set) .Ve .PP Get/set the cookie's commentURL string. Only valid for Version 1 cookies. .PP .Vb 3 \& $commentURL = $cookie\->commentURL; \& $cookie\->commentURL("/foo/bar"); \& ok $cookie\->commentURL eq "/foo/bar"; .Ve .SS "is_tainted" .IX Subsection "is_tainted" .Vb 2 \& $cookie\->is_tainted() \& $cookie\->is_tainted($set) .Ve .PP Get/set the cookie's internal tainted flag. .PP .Vb 3 \& $tainted = $cookie\->is_tainted; \& $cookie\->is_tainted(1); \& ok $cookie\->is_tainted == 1; .Ve .SS "make" .IX Subsection "make" .Vb 1 \& APR::Request::Cookie\->make($pool, $name, $value) .Ve .PP Fast \s-1XS\s0 cookie constructor invoked by \f(CW\*(C`new()\*(C'\fR. The cookie's raw name & value are taken directly from the passed in arguments; no freezing/encoding is done on the \f(CW$value\fR. .SS "as_string" .IX Subsection "as_string" .Vb 1 \& $cookie\->as_string() .Ve .PP String representation of the cookie, suitable for inclusion in a \*(L"Set-Cookie\*(R" header. .PP .Vb 1 \& print "Set\-Cookie: ", $cookie\->as_string, "\en"; .Ve .SH "SUBROUTINES" .IX Header "SUBROUTINES" .Vb 1 \& APR::Request::Cookie .Ve .SS "expires" .IX Subsection "expires" .Vb 1 \& expires($date_string) .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Apache2::Cookie, APR::Request. .SH "COPYRIGHT" .IX Header "COPYRIGHT" .Vb 6 \& 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 "License"); you may not use this file except in compliance with \& the License. You may obtain a copy of the License at \& \& http://www.apache.org/licenses/LICENSE\-2.0 \& \& Unless required by applicable law or agreed to in writing, software \& distributed under the License is distributed on an "AS IS" 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. .Ve