Branch Coverage

blib/lib/HTTP/Cookies.pm
Criterion Covered Total %
branch 176 216 81.4


line true false branch
40 3 67 unless ($scheme =~ /^https?\z/)
45 4 63 unless $domain =~ /\./
50 3 64 if $req_path =~ /%/
59 195 57 unless $cookies
60 0 57 if ($self->{'delayload'} and defined $cookies->{'//+delayload'})
65 0 0 unless $cookies
72 7 60 if (index($req_path, $path) != 0)
79 1 74 if ($secure and not $secure_request)
82 0 74 if ($expires and $expires < $now)
85 7 67 if ($port)
87 4 3 if ($port =~ s/^_//) { }
89 4 0 if $port eq $req_port
95 3 4 if $p eq $req_port
98 0 7 unless ($found)
102 0 74 if ($version > 0 and $netscape_only)
109 50 24 unless ($set_ver++)
110 18 32 if ($version >= 1) { }
32 0 elsif (not $self->{'hide_cookie2'}) { }
119 0 74 if ($val =~ /\W/ and $version)
126 31 43 if ($version >= 1)
127 16 15 if $path_spec
128 8 23 if $domain =~ /^\./
129 7 24 if (defined $port)
131 3 4 if length $port
150 126 126 if ($domain =~ s/^\.+//) { }
159 50 17 if (@cval)
160 2 48 if (my $old = $request->header('Cookie'))
164 8 42 if (my $hash = $request->{'_http_cookies'})
177 6 3 unless $url =~ /^[a-zA-Z][a-zA-Z0-9.+\-]*:/
182 8 1 if (@_)
183 1 7 if wantarray
198 7 62 unless @set or @ns_set
203 3 59 unless $req_host =~ /\./
206 2 60 if $req_path =~ /%/
208 32 30 if (@ns_set)
231 1 105 unless length $param
233 103 2 if (defined $v) { }
241 14 91 if (not $first_param and lc $k eq 'expires') { }
2 89 elsif (not $first_param and lc($k) =~ /^(?:version|discard|ns-cookie)/) { }
243 12 2 if (defined $etime) { }
250 2 0 if ($year)
252 2 0 if ($year < $thisyear) { }
0 0 elsif ($year >= $thisyear + 10) { }
273 1 41 unless @cur
274 1 40 if $in_set2{$cur[0]}
277 26 14 unless $expires
286 0 76 unless @$set >= 2
297 191 43 if $lc =~ /^(?:discard|domain|max-age| path|port|secure|version)$/x
299 33 201 if ($k eq 'discard' or $k eq 'secure')
300 33 0 unless defined $v
302 0 234 if exists $hash{$k}
308 16 60 unless defined $version
316 25 51 if defined $domain
317 17 59 if (defined $domain and $domain ne $req_host and $domain ne ".$req_host") { }
319 0 17 if (not $domain =~ /\./ and $domain ne 'local')
322 3 14 unless $domain =~ /^\./
323 1 16 if ($domain =~ /\.\d+$/)
327 0 16 unless (substr($req_host, -$len) eq $domain)
331 2 14 if ($hostpre =~ /\./ and not $ns_cookie)
341 49 24 if (defined $path and $path ne '') { }
343 1 48 if $path =~ /%/
344 4 45 if (not $ns_cookie and substr($req_path, 0, length $path) ne $path)
352 23 1 unless length $path
356 5 64 if (exists $hash{'port'})
358 3 2 if (defined $port) { }
362 0 7 unless ($p =~ /^\d+$/)
365 2 5 if $p eq $req_port
367 1 2 unless ($found)
375 68 0 if $self->set_cookie_ok(\%orig_hash)
396 0 73 if not defined $path && $path =~ m[^/] && defined $key or $key =~ /^\$/
400 4 69 if (defined $port)
401 0 4 unless $port =~ /^_?\d+(?:,\d+)*$/
405 23 50 if (defined $maxage)
406 8 15 if ($maxage <= 0)
412 2 63 unless defined $version
417 3 62 if defined $rest and %$rest
431 1 1 @_ == 1 ? :
434 0 2 if keys %args > 2
436 0 2 unless open my $fh, '>', $file
439 0 2 unless close $fh
450 0 2 unless open my $fh, '<', $file
455 0 2 unless ($magic =~ /^#LWP-Cookies-\d+\.\d+/)
463 0 7 unless $line =~ s/^Set-Cookie3:\s*//
485 1 6 if %hash
504 5 0 if (@_ == 0) { }
0 0 elsif (@_ == 1) { }
0 0 elsif (@_ == 2) { }
0 0 elsif (@_ == 3) { }
529 3 3 if ($_[9] or not $_[8])
542 0 27 if $self->{'autosave'}
556 121 8 unless defined $rest
572 0 48 if $discard and $skip_discard
576 7 41 if defined $port
577 24 24 if $path_spec
578 0 48 if $secure
579 10 38 if $expires
580 18 30 if $discard
594 32 97 if (my $h = $request->header('Host'))
605 0 129 if ($url->can('epath')) { }
611 36 93 unless length $path
620 9 26 $x eq '2F' || $x eq '25' ? :
637 18 185 if ($in_string) { }
638 2 16 if ($chunk eq '\\') { }
4 12 elsif ($chunk eq '"') { }
643 2 0 if ($i < @vals)
653 4 181 if ($chunk eq '"') { }
71 110 elsif ($chunk eq ';') { }
665 41 3 if @current_string