1Dancer2::Core::Cookie(3U)ser Contributed Perl DocumentatiDoanncer2::Core::Cookie(3)
2
3
4

NAME

6       Dancer2::Core::Cookie - A cookie representing class
7

VERSION

9       version 0.400001
10

SYNOPSIS

12           use Dancer2::Core::Cookie;
13
14           my $cookie = Dancer2::Core::Cookie->new(
15               name => $cookie_name, value => $cookie_value
16           );
17
18           my $value = $cookie->value;
19
20           print "$cookie"; # objects stringify to their value.
21

DESCRIPTION

23       Dancer2::Core::Cookie provides a HTTP cookie object to work with
24       cookies.
25

ATTRIBUTES

27   value
28       The cookie's value.
29
30       (Note that cookie objects use overloading to stringify to their value,
31       so if you say e.g. return "Hi, $cookie", you'll get the cookie's value
32       there.)
33
34       In list context, returns a list of potentially multiple values; in
35       scalar context, returns just the first value.  (So, if you expect a
36       cookie to have multiple values, use list context.)
37
38   name
39       The cookie's name.
40
41   expires
42       The cookie's expiration date.  There are several formats.
43
44       Unix epoch time like 1288817656 to mean "Wed, 03-Nov-2010 20:54:16 GMT"
45
46       It also supports a human readable offset from the current time such as
47       "2 hours".  See the documentation of Dancer2::Core::Time for details of
48       all supported formats.
49
50   domain
51       The cookie's domain.
52
53   path
54       The cookie's path.
55
56   secure
57       If true, it instructs the client to only serve the cookie over secure
58       connections such as https.
59
60   http_only
61       By default, cookies are created with a property, named "HttpOnly", that
62       can be used for security, forcing the cookie to be used only by the
63       server (via HTTP) and not by any JavaScript code.
64
65       If your cookie is meant to be used by some JavaScript code, set this
66       attribute to 0.
67
68   same_site
69       Whether the cookie ought not to be sent along with cross-site requests.
70       Valid values are "Strict", "Lax", or "None". Default is unset.  Refer
71       to RFC6265bis <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-
72       same-site> for further details regarding same-site context.
73

METHODS

75   my $cookie=Dancer2::Core::Cookie->new(%opts);
76       Create a new Dancer2::Core::Cookie object.
77
78       You can set any attribute described in the ATTRIBUTES section above.
79
80   my $header=$cookie->to_header();
81       Creates a proper HTTP cookie header from the content.
82

AUTHOR

84       Dancer Core Developers
85
87       This software is copyright (c) 2023 by Alexis Sukrieh.
88
89       This is free software; you can redistribute it and/or modify it under
90       the same terms as the Perl 5 programming language system itself.
91
92
93
94perl v5.38.0                      2023-07-20          Dancer2::Core::Cookie(3)
Impressum