Branch Coverage

lib/Pcore/HTTP/Cookies.pm
Criterion Covered Total %
branch 48 90 53.3


line true false branch
28 22 0 unless ref $url
33 0 16 unless defined $kvp
39 0 16 if $kvp eq ''
52 10 6 if ((my $idx = index($kvp, '=')) != -1) { }
70 0 20 if $attr eq ''
74 20 0 if ((my $idx = index($attr, '=')) != -1) { }
85 16 4 if ($k eq 'domain') { }
3 1 elsif ($k eq 'path') { }
1 0 elsif ($k eq 'expires') { }
0 0 elsif ($k eq 'max-age') { }
0 0 elsif ($k eq 'httponly') { }
0 0 elsif ($k eq 'secure') { }
86 14 2 if ($v ne '')
93 0 14 if $url->host->is_ip
99 0 14 if $cover_domain->is_ip
104 7 7 if ($cover_domain_name eq $origin_domain_name) { }
108 3 4 if $cover_domain->is_pub_suffix
112 3 4 if $cover_domain->is_pub_suffix
115 2 2 if ((my $idx = index($origin_domain_name, '.' . $cover_domain_name)) > 0) { }
116 0 2 if length $origin_domain_name != 1 + $idx + length($cover_domain_name)
128 0 3 if ($v ne '')
133 1 0 if ($v ne '')
134 1 0 unless ($$cookie{'expires'})
135 1 0 if (my $expires = eval { do { 'Pcore'->date->parse($v) } }) { }
146 0 0 if ($v ne '')
147 0 0 if ($v =~ /\A\d+\z/msu) { }
164 1 10 if ($$cookie{'expires'} and $$cookie{'expires'} < time) { }
177 12 0 if $cookie_path eq $url_path
179 0 0 if $cookie_path eq '/'
181 0 0 if ($url_path =~ /\A\Q$cookie_path\E(.*)/msu)
184 0 0 if substr($cookie_path, -1, 1) eq '/'
186 0 0 if substr($rest, 0, 1) eq '/'
198 12 0 if (&$match_path($url->path, $cookie_path))
200 0 14 if ($$cookie{'expires'} and $$cookie{'expires'} < $time) { }
206 0 14 if $$cookie{'secure'} and not $url->is_secure
217 12 0 unless ref $url
224 6 6 if (my $origin_cookies = $$self{'cookies'}{$origin_domain_name})
225 6 0 if (my $match_cookies = &$match_domain($self, $origin_domain_name, $origin_cookies, $url))
232 12 0 unless ($url->host->is_ip)
242 6 19 if (my $cover_cookies = $$self{'cookies'}{$cover_domain_name})
243 6 0 if (my $match_cookies = &$match_domain($self, $cover_domain_name, $cover_cookies, $url))
248 2 23 if $domain->is_pub_suffix and not $origin
260 1 0 if (delete $$self{'cookies'}{$domain}{$path}{$name})
261 1 0 unless keys %{$$self{'cookies'}{$domain}{$path}}
263 1 0 unless keys %{$$self{'cookies'}{$domain}}