Branch Coverage

blib/lib/Dancer2/Core/App.pm
Criterion Covered Total %
branch 231 270 85.5


line true false branch
58 1 38 if (is_ref($plugin))
62 0 1 if (my($already) = grep({ref $plugin eq ref $_;} @{$self->plugins;})) { }
63 0 0 if refaddr($plugin) != $already->refaddr
76 7 31 unless ($plugin =~ s/^\+//)
81 2 36 if (my($already) = grep({$plugin eq ref $_;} @{$self->plugins;}))
94 0 39 unless @_ == 2
236 162 21 unless defined $config
237 164 19 unless defined $value
239 1 182 if is_ref($value)
243 0 182 unless defined $value
245 1 181 unless &is_module_name($value)
260 90 91 if exists $config->{'log'}
270 174 17 unless defined $config
271 176 15 unless defined $value
273 3 188 if is_ref($value)
275 1 187 unless &is_module_name($value)
299 164 16 unless defined $config
300 166 14 unless defined $value
302 0 180 unless defined $value
303 0 180 if is_ref($value)
305 1 179 unless &is_module_name($value)
335 0 22 unless defined $config
336 0 22 unless defined $value
338 0 22 unless defined $value
339 0 22 if is_ref($value)
362 550 25 unless defined $config->{'engines'} and defined $config->{'engines'}{$engine}
369 1 24 $was_fully_qualified ? :
374 21 13 if (defined $config->{'engines'}{$engine}{$engine_name})
484 2 255 if ($config and $config->{'engines'})
498 84 605 $self->has_serializer_engine ? :
500 0 0 if $weak_self
516 88 5 unless ($self->has_destroyed_session)
519 53 35 if defined $session_cookie
523 53 35 if (defined $session_id)
530 3 50 unless (eval { do { &$EVAL_SHIM(sub { $session = $engine->retrieve("id", $session_id); } ); 1 } })
532 0 3 if (not $err =~ /Unable to retrieve session/) { }
572 1 1 unless $plugin
602 354 0 $self->has_session ? :
616 3 2 if ($engine->can('_change_id')) { }
654 2 0 unless $key eq "id"
827 0 501 unless defined $engine
839 76 425 if ($app->has_session) { }
12 413 elsif ($app->has_destroyed_session) { }
841 73 3 if ($app->_has_session) { }
843 48 25 if $session->is_dirty
921 164 1481 $self->has_serializer_engine ? :
962 2 27 unless grep(($_ eq $name), @{$self->supported_engines;})
987 2 34 if $self->has_request and $self->has_session and not $template->has_session
991 33 4 if ($self->has_with_return)
1004 3 30 if ($local_response) { }
6 24 elsif ($eval_result) { }
1022 0 45 if builtin::blessed($handler_code) and $handler_code->can("supported_hooks")
1047 0 2835 unless my $logger = $self->logger_engine
1058 1 10 unless $type
1060 5 5 if (lc $type eq "html" or lc $type eq "plain")
1061 0 5 if ($type ne lc $type)
1068 5 0 if (defined $options->{'charset'} and length $options->{'charset'})
1084 2 3 unless (eval { do { &$EVAL_SHIM(sub { &require_module($serializer_class); } ); 1 } })
1114 2 6 $self->has_serializer_engine ? :
1122 8 0 if $self->has_with_return
1140 0 20 if (builtin::blessed($thing) and $thing->isa("IO::Scalar"))
1145 9 11 if (is_scalarref($thing))
1151 10 10 unless ($fh)
1155 0 10 if ($prefix and $prefix ne "/")
1160 4 6 $options{'system_path'} ? :
1175 4 6 $pt_path->is_absolute ? :
1182 1 9 unless $dir->realpath->subsumes($file_path)
1185 0 9 unless $file_path->exists
1186 0 9 unless $file_path->is_file
1187 0 9 unless -r $file_path
1192 6 3 if ($content_type =~ m[^text/])
1204 10 9 if exists $options{'content_type'}
1205 7 12 if exists $options{'charset'}
1206 13 6 if $content_type and $charset
1207 18 1 if defined $content_type
1213 2 17 if exists $options{'filename'}
1216 2 17 exists $options{'streaming'} ? :
1219 18 1 if ($env->{'psgi.streaming'} and $use_streaming) { }
1267 187 35 unless defined $self->config->{'static_handler'}
1272 0 222 if @{$self->plugins;} and $self->plugins->[0]->can("_add_postponed_plugin_hooks")
1289 255 0 unless is_ref($config)
1322 1 730 if $Dancer2::Core::Route::RESPONSE and $Dancer2::Core::Route::RESPONSE->is_halted
1327 9 715 unless (eval { do { &$EVAL_SHIM($hook, @_); 1 } })
1333 7 2 unless $is_hook_exception
1341 6 2 unless $is_hook_exception
1347 3 5 if $is_halted
1365 1 4 if $prefix eq "/"
1371 2 3 defined $app_prefix ? :
4 1 defined $prefix ? :
1376 4 1 if length $new_prefix
1380 1 4 unless (my $ok = eval { do { &$EVAL_SHIM($cb); 1 } })
1385 1 4 unless $ok
1401 11 675 if ($method ne "head" and $route->has_name)
1403 1 10 if $self->route_names->{$name}
1419 0 0 if $existing_route->spec_route eq $route->spec_route
1436 586 3 if @_ == 1
1450 12 14 if ($destination =~ m[^/(?!/)])
1462 26 0 if $self->has_with_return
1471 7 0 if $self->has_with_return
1480 2 0 if $self->has_with_return
1492 44 0 if $self->has_with_return
1508 7 46 if exists $options->{'method'}
1517 42 11 unless $engine and $self->_has_session
1519 1 10 if exists $new_request->cookies->{$name}
1541 23 197 if ($self->config->{'serializer'})
1553 2 629 unless $Dancer2::Core::Types::supported_http_methods{$method}
1564 1 628 unless (eval { do { &$EVAL_SHIM(sub { $response = $self->dispatch($env)->to_psgi; } ); 1 } })
1577 119 101 if ($self->config->{'static_handler'})
1591 433 2 defined $env->{'PATH_INFO'} && length $env->{'PATH_INFO'} ? :
1600 216 4 unless ($self->config->{'no_default_middleware'})
1623 4 625 unless ($request_built_successfully)
1653 778 588 unless my $match = $route->match($request)
1662 6 582 if (my $sess = $runner->{'internal_sessions'}{$cname})
1676 588 0 unless ($self->has_with_return)
1690 44 544 if (ref $response eq "Dancer2::Core::Request")
1697 17 27 if ($runner->{'internal_dispatch'})
1702 8 9 if $self->_has_session
1717 34 510 if ($response->is_halted)
1724 9 501 if ($response->has_passed)
1728 7 2 if exists $request->{'_params'}{'splat'}
1754 51 22 if ($runner->{'internal_dispatch'})
1776 83 497 $self->has_serializer_engine ? :
1794 4 579 unless (eval { do { &$EVAL_SHIM(sub { $self->execute_hook("core.app.before_request", $self); } ); 1 } })
1800 2 577 if ($response->is_halted)
1807 14 462 unless (eval { do { &$EVAL_SHIM(sub { $response = $route->execute($self); } ); 1 } })
1822 485 0 if (exists $config->{'content_type'} and my $ct = $config->{'content_type'})
1827 485 0 if exists $config->{'charset'}
1830 472 13 if defined $content
1873 2 16 unless my $route = $self->route_names->{$route_name}
1877 0 16 if is_regexpref($string)
1881 4 12 if (is_arrayref($route_params))
1894 2 12 unless my $value = $route_params->{$param}
1911 6 8 if ($splat_params and @token_or_splat)
1912 2 4 unless $#{$splat_params;} == $#token_or_splat
1916 4 6 if (is_arrayref($splat_params->[$i])) { }