Mojo/Cookie.pm

filter: Statementstmt 93.3% 14 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 2 / 2 totaltotal 91.6% 22 / 24 CC 1 SCAR 0.0
CC
1
Cov
93%
BEGIN
1.0
__ANON__
1.0
__ANON__
1.0
CRAP 1.0
« Mojo/Reactor/EV.pm ↑ Summary Mojo/HelloWorld.pm »
1 package Mojo::Cookie;
2 30 ▶use Mojo::Base -base;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 0 ▶use overload bool => sub {1}, '""' => sub { shift->to_string }, fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine __ANON__: not called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
4  
5 30 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 30 has [qw(name value)];
8  
9 1 ▶sub parse { croak 'Method "parse" not implemented by subclass' }
Subroutine parse: called CC=1 SCAR=0.0
Pod documented
10 1 ▶sub to_string { croak 'Method "to_string" not implemented by subclass' }
Subroutine to_string: called CC=1 SCAR=0.0
Pod documented
11  
12 30 1;
13  
14 =encoding utf8
15  
16 =head1 NAME
17  
18 Mojo::Cookie - HTTP cookie base class
19  
20 =head1 SYNOPSIS
21  
22 package Mojo::Cookie::MyCookie;
23 use Mojo::Base 'Mojo::Cookie';
24  
25 sub parse {...}
26 sub to_string {...}
27  
28 =head1 DESCRIPTION
29  
30 L<Mojo::Cookie> is an abstract base class for HTTP cookie containers, based on L<RFC
31 6265|https://tools.ietf.org/html/rfc6265>, like L<Mojo::Cookie::Request> and L<Mojo::Cookie::Response>.
32  
33 =head1 ATTRIBUTES
34  
35 L<Mojo::Cookie> implements the following attributes.
36  
37 =head2 name
38  
39 my $name = $cookie->name;
40 $cookie = $cookie->name('foo');
41  
42 Cookie name.
43  
44 =head2 value
45  
46 my $value = $cookie->value;
47 $cookie = $cookie->value('/test');
48  
49 Cookie value.
50  
51 =head1 METHODS
52  
53 L<Mojo::Cookie> inherits all methods from L<Mojo::Base> and implements the following new ones.
54  
55 =head2 parse
56  
57 my $cookies = $cookie->parse($str);
58  
59 Parse cookies. Meant to be overloaded in a subclass.
60  
61 =head2 to_string
62  
63 my $str = $cookie->to_string;
64  
65 Render cookie. Meant to be overloaded in a subclass.
66  
67 =head1 OPERATORS
68  
69 L<Mojo::Cookie> overloads the following operators.
70  
71 =head2 bool
72  
73 my $bool = !!$cookie;
74  
75 Always true.
76  
77 =head2 stringify
78  
79 my $str = "$cookie";
80  
81 Alias for L</"to_string">.
82  
83 =head1 SEE ALSO
84  
85 L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
86  
87 =cut
« Mojo/Reactor/EV.pm ↑ Summary Mojo/HelloWorld.pm »