1Mojo::Cookie(3) User Contributed Perl Documentation Mojo::Cookie(3)
2
3
4
6 Mojo::Cookie - HTTP cookie base class
7
9 package Mojo::Cookie::MyCookie;
10 use Mojo::Base 'Mojo::Cookie';
11
12 sub parse {...}
13 sub to_string {...}
14
16 Mojo::Cookie is an abstract base class for HTTP cookie containers,
17 based on RFC 6265 <https://tools.ietf.org/html/rfc6265>, like
18 Mojo::Cookie::Request and Mojo::Cookie::Response.
19
21 Mojo::Cookie implements the following attributes.
22
23 name
24 my $name = $cookie->name;
25 $cookie = $cookie->name('foo');
26
27 Cookie name.
28
29 value
30 my $value = $cookie->value;
31 $cookie = $cookie->value('/test');
32
33 Cookie value.
34
36 Mojo::Cookie inherits all methods from Mojo::Base and implements the
37 following new ones.
38
39 parse
40 my $cookies = $cookie->parse($str);
41
42 Parse cookies. Meant to be overloaded in a subclass.
43
44 to_string
45 my $str = $cookie->to_string;
46
47 Render cookie. Meant to be overloaded in a subclass.
48
50 Mojo::Cookie overloads the following operators.
51
52 bool
53 my $bool = !!$cookie;
54
55 Always true.
56
57 stringify
58 my $str = "$cookie";
59
60 Alias for "to_string".
61
63 Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
64
65
66
67perl v5.34.0 2022-01-21 Mojo::Cookie(3)