Branch Coverage

blib/lib/Dancer2/Core/App.pm
Criterion Covered Total %
branch 222 258 86.0


line true false branch
60 1 36 if (is_ref($plugin))
64 0 1 if (my($already) = grep({ref $plugin eq ref $_;} @{$self->plugins;})) { }
65 0 0 if refaddr($plugin) != $already->refaddr
78 7 29 unless ($plugin =~ s/^\+//)
83 2 34 if (my($already) = grep({$plugin eq ref $_;} @{$self->plugins;}))
96 0 37 unless @_ == 2
202 159 19 unless defined $config
203 161 17 unless defined $value
205 1 177 if is_ref($value)
209 0 177 unless defined $value
211 1 176 unless &is_module_name($value)
226 88 88 if exists $config->{'log'}
236 170 17 unless defined $config
237 172 15 unless defined $value
239 3 184 if is_ref($value)
241 1 183 unless &is_module_name($value)
265 159 16 unless defined $config
266 161 14 unless defined $value
268 0 175 unless defined $value
269 0 175 if is_ref($value)
271 1 174 unless &is_module_name($value)
300 0 22 unless defined $config
301 0 22 unless defined $value
303 0 22 unless defined $value
304 0 22 if is_ref($value)
326 536 24 unless defined $config->{'engines'} and defined $config->{'engines'}{$engine}
332 20 11 if (defined $config->{'engines'}{$engine}{$engine_name})
442 2 249 if ($config and $config->{'engines'})
452 84 601 $self->has_serializer_engine ? :
467 88 5 unless ($self->has_destroyed_session)
470 53 35 if defined $session_cookie
474 53 35 if (defined $session_id)
481 3 50 unless (eval { do { &$EVAL_SHIM(sub { $session = $engine->retrieve("id", $session_id); } ); 1 } })
483 0 3 if (not $err =~ /Unable to retrieve session/) { }
523 1 1 unless $plugin
553 354 0 $self->has_session ? :
567 3 2 if ($engine->can('_change_id')) { }
605 2 0 unless $key eq "id"
758 0 498 unless defined $engine
770 76 422 if ($app->has_session) { }
12 410 elsif ($app->has_destroyed_session) { }
772 73 3 if ($app->_has_session) { }
774 48 25 if $session->is_dirty
852 164 1478 $self->has_serializer_engine ? :
896 2 27 unless grep(($_ eq $name), @{$self->supported_engines;})
921 2 34 if $self->has_request and $self->has_session and not $template->has_session
925 33 4 if ($self->has_with_return)
938 3 30 if ($local_response) { }
6 24 elsif ($eval_result) { }
956 0 45 if builtin::blessed($handler_code) and $handler_code->can("supported_hooks")
983 1 9 exists $self->config->{'default_mime_type'} ? :
992 0 2820 unless my $logger = $self->logger_engine
1003 1 10 unless $type
1005 5 5 if (lc $type eq "html" or lc $type eq "plain")
1006 0 5 if ($type ne lc $type)
1026 2 3 unless (eval { do { &$EVAL_SHIM(sub { &require_module($serializer_class); } ); 1 } })
1044 2 6 $self->has_serializer_engine ? :
1055 8 0 if $self->has_with_return
1073 0 19 if (builtin::blessed($thing) and $thing->isa("IO::Scalar"))
1078 9 10 if (is_scalarref($thing))
1084 9 10 unless ($fh)
1088 0 9 if ($prefix and $prefix ne "/")
1096 4 5 $options{'system_path'} ? :
1106 0 9 unless defined $file_path
1107 0 9 unless -f $file_path
1108 0 9 unless -r $file_path
1114 5 4 if ($content_type =~ m[^text/])
1123 10 9 if exists $options{'content_type'}
1124 7 12 if exists $options{'charset'}
1125 12 7 if $content_type and $charset
1126 18 1 if defined $content_type
1132 2 17 if exists $options{'filename'}
1135 2 17 exists $options{'streaming'} ? :
1138 18 1 if ($env->{'psgi.streaming'} and $use_streaming) { }
1179 183 35 unless defined $self->config->{'static_handler'}
1184 0 218 if @{$self->plugins;} and $self->plugins->[0]->can("_add_postponed_plugin_hooks")
1201 249 0 unless is_ref($config)
1234 1 730 if $Dancer2::Core::Route::RESPONSE and $Dancer2::Core::Route::RESPONSE->is_halted
1239 9 715 unless (eval { do { &$EVAL_SHIM($hook, @_); 1 } })
1245 7 2 unless $is_hook_exception
1253 6 2 unless $is_hook_exception
1259 3 5 if $is_halted
1277 1 4 if $prefix eq "/"
1283 2 3 defined $app_prefix ? :
4 1 defined $prefix ? :
1288 4 1 if length $new_prefix
1292 1 4 unless (my $ok = eval { do { &$EVAL_SHIM($cb); 1 } })
1297 1 4 unless $ok
1313 11 665 if ($method ne "head" and $route->has_name)
1315 1 10 if $self->route_names->{$name}
1331 0 0 if $existing_route->spec_route eq $route->spec_route
1348 583 0 if @_ == 1
1362 12 14 if ($destination =~ m[^/(?!/)])
1374 26 0 if $self->has_with_return
1383 7 0 if $self->has_with_return
1392 2 0 if $self->has_with_return
1404 44 0 if $self->has_with_return
1420 7 46 if exists $options->{'method'}
1429 42 11 unless $engine and $self->_has_session
1431 1 10 if exists $new_request->cookies->{$name}
1453 23 193 if ($self->config->{'serializer'})
1465 2 626 unless $Dancer2::Core::Types::supported_http_methods{$method}
1476 1 625 unless (eval { do { &$EVAL_SHIM(sub { $response = $self->dispatch($env)->to_psgi; } ); 1 } })
1489 118 98 if ($self->config->{'static_handler'})
1505 212 4 unless ($self->config->{'no_default_middleware'})
1528 4 622 unless ($request_built_successfully)
1557 769 585 unless my $match = $route->match($request)
1566 6 579 if (my $sess = $runner->{'internal_sessions'}{$cname})
1580 585 0 unless ($self->has_with_return)
1594 44 541 if (ref $response eq "Dancer2::Core::Request")
1601 17 27 if ($runner->{'internal_dispatch'})
1606 8 9 if $self->_has_session
1621 34 507 if ($response->is_halted)
1628 9 498 if ($response->has_passed)
1632 7 2 if exists $request->{'_params'}{'splat'}
1658 51 22 if ($runner->{'internal_dispatch'})
1679 83 494 $self->has_serializer_engine ? :
1697 4 576 unless (eval { do { &$EVAL_SHIM(sub { $self->execute_hook("core.app.before_request", $self); } ); 1 } })
1703 2 574 if ($response->is_halted)
1710 14 460 unless (eval { do { &$EVAL_SHIM(sub { $response = $route->execute($self); } ); 1 } })
1725 483 0 if (exists $config->{'content_type'} and my $ct = $config->{'content_type'})
1731 470 13 if defined $content
1772 2 16 unless my $route = $self->route_names->{$route_name}
1776 0 16 if is_regexpref($string)
1780 4 12 if (is_arrayref($route_params))
1793 2 12 unless my $value = $route_params->{$param}
1810 6 8 if ($splat_params and @token_or_splat)
1811 2 4 unless $#{$splat_params;} == $#token_or_splat
1815 4 6 if (is_arrayref($splat_params->[$i])) { }