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.300004
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       an enum of either "Strict" or "Lax", default is unset.
71

METHODS

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

AUTHOR

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