.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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 "Dancer2::Core::Cookie 3pm" .TH Dancer2::Core::Cookie 3pm "2023-12-15" "perl v5.36.0" "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" Dancer2::Core::Cookie \- A cookie representing class .SH "VERSION" .IX Header "VERSION" version 1.1.0 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Dancer2::Core::Cookie; \& \& my $cookie = Dancer2::Core::Cookie\->new( \& name => $cookie_name, value => $cookie_value \& ); \& \& my $value = $cookie\->value; \& \& print "$cookie"; # objects stringify to their value. .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Dancer2::Core::Cookie provides a \s-1HTTP\s0 cookie object to work with cookies. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "value" .IX Subsection "value" The cookie's value. .PP (Note that cookie objects use overloading to stringify to their value, so if you say e.g. return \*(L"Hi, \f(CW$cookie\fR\*(R", you'll get the cookie's value there.) .PP In list context, returns a list of potentially multiple values; in scalar context, returns just the first value. (So, if you expect a cookie to have multiple values, use list context.) .SS "name" .IX Subsection "name" The cookie's name. .SS "expires" .IX Subsection "expires" The cookie's expiration date. There are several formats. .PP Unix epoch time like 1288817656 to mean \*(L"Wed, 03\-Nov\-2010 20:54:16 \s-1GMT\*(R"\s0 .PP It also supports a human readable offset from the current time such as \*(L"2 hours\*(R". See the documentation of Dancer2::Core::Time for details of all supported formats. .SS "domain" .IX Subsection "domain" The cookie's domain. .SS "path" .IX Subsection "path" The cookie's path. .SS "secure" .IX Subsection "secure" If true, it instructs the client to only serve the cookie over secure connections such as https. .SS "http_only" .IX Subsection "http_only" By default, cookies are created with a property, named \f(CW\*(C`HttpOnly\*(C'\fR, that can be used for security, forcing the cookie to be used only by the server (via \s-1HTTP\s0) and not by any JavaScript code. .PP If your cookie is meant to be used by some JavaScript code, set this attribute to 0. .SS "same_site" .IX Subsection "same_site" Whether the cookie ought not to be sent along with cross-site requests. Valid values are \f(CW\*(C`Strict\*(C'\fR, \f(CW\*(C`Lax\*(C'\fR, or \f(CW\*(C`None\*(C'\fR. Default is unset. Refer to RFC6265bis for further details regarding same-site context. .SH "METHODS" .IX Header "METHODS" .ie n .SS "my $cookie=Dancer2::Core::Cookie\->new(%opts);" .el .SS "my \f(CW$cookie\fP=Dancer2::Core::Cookie\->new(%opts);" .IX Subsection "my $cookie=Dancer2::Core::Cookie->new(%opts);" Create a new Dancer2::Core::Cookie object. .PP You can set any attribute described in the \fI\s-1ATTRIBUTES\s0\fR section above. .ie n .SS "my $header=$cookie\->\fBto_header()\fP;" .el .SS "my \f(CW$header\fP=$cookie\->\fBto_header()\fP;" .IX Subsection "my $header=$cookie->to_header();" Creates a proper \s-1HTTP\s0 cookie header from the content. .SH "AUTHOR" .IX Header "AUTHOR" Dancer Core Developers .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2023 by Alexis Sukrieh. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.