Branch Coverage

blib/lib/Mojo/UserAgent/Cached.pm
Criterion Covered Total %
branch 72 96 75.0


line true false branch
116 6 0 if ($self->is_cacheable($key))
127 2 0 if ($self->is_cacheable($key))
140 11 90 unless ($url =~ m[^(/|[^/]+:)]u)
141 5 6 if ($self->local_dir) { }
0 6 elsif ($self->always_return_file) { }
6 0 elsif (not $url =~ m[^(/|[^/]+:)]u) { }
162 82 18 $method eq 'GET' ? :
0 100 unless $headers
7 93 keys %{{} unless $headers;} ? :
167 3 97 if $self->{'pid'} and $self->{'pid'} ne $$
174 25 75 $cb ? :
177 88 12 if (not $url =~ m[ \A file:// ]gmux and 'Mojo::URL'->new($url)->is_abs || $url =~ m[ \A / ]gmux && !$self->always_return_file) { }
178 27 61 if ($self->is_cacheable($key))
180 14 13 if ($serialized)
193 2 12 if $cb
199 22 52 if ($wrapper_cb)
214 2 10 unless eval { do { $res = $self->_parse_local_file_res($url); $code = $res->{'code'} } }
229 1 11 if $cb
239 13 61 if ($tx->req->url->scheme ne "file" and $self->is_cacheable($key))
240 4 9 if ($self->is_considered_error($tx)) { }
242 4 0 if ($self->use_expired_cached_content)
243 1 3 if (my $cache_obj = $self->cache_agent->get_object($key))
281 0 9 unless $self->cache_url_opts
289 0 1 if ref $key
306 1 3 if ref $key
327 7 26 @opts > 1 ? :
33 80 @opts ? :
336 2 11 if ($tx->error and $self->accepted_error_codes)
337 0 2 ref $self->accepted_error_codes ? :
339 2 0 if &List::Util::first(sub { $tx->error->{'code'} == $_; } , @{$codes;})
347 0 119 unless $self->sorted_queries
349 118 1 unless ref $url eq "Mojo::URL"
351 28 91 $url->protocol ? :
1 118 $url->userinfo ? :
16 103 $url->host ? :
119 0 $url->path ? :
356 16 5 $b ne '' ? :
357 14 105 if scalar @{$url->query;}
410 2 8 if ($body =~ /\A (?: DELETE | GET | HEAD | OPTIONS | PATCH | POST | PUT ) \s /gmux)
428 0 0 unless $dir and -e $dir and -d $dir
438 0 0 if "Mojo::File"->new($target_file)->spurt(join("\n\n", join(" ", $method, "$url\n") . $tx->req->headers->to_string, join(" ", $code, "$message\n") . $tx->res->headers->to_string, $body))
460 24 0 if (scalar @lcss > 2)
461 0 100 unless $strings
470 100 0 unless $self->access_log
490 0 0 unless syswrite $fh, qq[$http_host $remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_time $upstream_response_time "$http_x_forwarded_for"\n]
492 0 0 unless close $fh
508 0 299 if ($package eq "Template::Provider")
511 42 257 if ($prev_package eq $package) { }