Branch Coverage

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


line true false branch
115 6 0 if ($self->is_cacheable($key))
126 2 0 if ($self->is_cacheable($key))
139 11 90 unless ($url =~ m[^(/|[^/]+:)]u)
140 5 6 if ($self->local_dir) { }
0 6 elsif ($self->always_return_file) { }
6 0 elsif (not $url =~ m[^(/|[^/]+:)]u) { }
161 82 18 $method eq 'GET' ? :
0 100 unless $headers
7 93 keys %{{} unless $headers;} ? :
166 3 97 if $self->{'pid'} and $self->{'pid'} ne $$
173 25 75 $cb ? :
176 88 12 if (not $url =~ m[ \A file:// ]gmux and 'Mojo::URL'->new($url)->is_abs || $url =~ m[ \A / ]gmux && !$self->always_return_file) { }
177 27 61 if ($self->is_cacheable($key))
179 14 13 if ($serialized)
192 2 12 if $cb
198 22 52 if ($wrapper_cb)
213 2 10 unless eval { do { $res = $self->_parse_local_file_res($url); $code = $res->{'code'} } }
228 1 11 if $cb
238 13 61 if ($tx->req->url->scheme ne "file" and $self->is_cacheable($key))
239 4 9 if ($self->is_considered_error($tx)) { }
241 4 0 if ($self->use_expired_cached_content)
242 1 3 if (my $cache_obj = $self->cache_agent->get_object($key))
280 0 9 unless $self->cache_url_opts
288 0 1 if ref $key
305 1 3 if ref $key
326 7 26 @opts > 1 ? :
33 80 @opts ? :
335 2 11 if ($tx->error and $self->accepted_error_codes)
336 0 2 ref $self->accepted_error_codes ? :
338 2 0 if &List::Util::first(sub { $tx->error->{'code'} == $_; } , @{$codes;})
346 0 119 unless $self->sorted_queries
348 118 1 unless ref $url eq "Mojo::URL"
350 28 91 $url->protocol ? :
1 118 $url->userinfo ? :
16 103 $url->host ? :
119 0 $url->path ? :
355 16 5 $b ne '' ? :
356 14 105 if scalar @{$url->query;}
409 2 8 if ($body =~ /\A (?: DELETE | GET | HEAD | OPTIONS | PATCH | POST | PUT ) \s /gmux)
427 0 0 unless $dir and -e $dir and -d $dir
437 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))
459 24 0 if (scalar @lcss > 2)
460 0 100 unless $strings
469 100 0 unless $self->access_log
489 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]
491 0 0 unless close $fh
507 0 299 if ($package eq "Template::Provider")
510 42 257 if ($prev_package eq $package) { }