1Mojo::Cookie::Response(U3s)er Contributed Perl DocumentatMioojno::Cookie::Response(3)
2
3
4

NAME

6       Mojo::Cookie::Response - HTTP response cookie
7

SYNOPSIS

9         use Mojo::Cookie::Response;
10
11         my $cookie = Mojo::Cookie::Response->new;
12         $cookie->name('foo');
13         $cookie->value('bar');
14         say "$cookie";
15

DESCRIPTION

17       Mojo::Cookie::Response is a container for HTTP response cookies, based
18       on RFC 6265 <https://tools.ietf.org/html/rfc6265>.
19

ATTRIBUTES

21       Mojo::Cookie::Response inherits all attributes from Mojo::Cookie and
22       implements the following new ones.
23
24   domain
25         my $domain = $cookie->domain;
26         $cookie    = $cookie->domain('localhost');
27
28       Cookie domain.
29
30   expires
31         my $expires = $cookie->expires;
32         $cookie     = $cookie->expires(time + 60);
33
34       Expiration for cookie.
35
36   host_only
37         my $bool = $cookie->host_only;
38         $cookie  = $cookie->host_only($bool);
39
40       Host-only flag, indicating that the canonicalized request-host is
41       identical to the cookie's "domain".
42
43   httponly
44         my $bool = $cookie->httponly;
45         $cookie  = $cookie->httponly($bool);
46
47       HttpOnly flag, which can prevent client-side scripts from accessing
48       this cookie.
49
50   max_age
51         my $max_age = $cookie->max_age;
52         $cookie     = $cookie->max_age(60);
53
54       Max age for cookie.
55
56   path
57         my $path = $cookie->path;
58         $cookie  = $cookie->path('/test');
59
60       Cookie path.
61
62   samesite
63         my $samesite = $cookie->samesite;
64         $cookie      = $cookie->samesite('Lax');
65
66       SameSite value. Note that this attribute is EXPERIMENTAL because even
67       though most commonly used browsers support the feature, there is no
68       specification yet besides this draft
69       <https://tools.ietf.org/html/draft-west-first-party-cookies-07>.
70
71   secure
72         my $bool = $cookie->secure;
73         $cookie  = $cookie->secure($bool);
74
75       Secure flag, which instructs browsers to only send this cookie over
76       HTTPS connections.
77

METHODS

79       Mojo::Cookie::Response inherits all methods from Mojo::Cookie and
80       implements the following new ones.
81
82   parse
83         my $cookies = Mojo::Cookie::Response->parse('f=b; path=/');
84
85       Parse cookies.
86
87   to_string
88         my $str = $cookie->to_string;
89
90       Render cookie.
91

SEE ALSO

93       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
94
95
96
97perl v5.34.0                      2022-01-21         Mojo::Cookie::Response(3)
Impressum