Branch Coverage

blib/lib/Catalyst.pm
Criterion Covered Total %
branch 427 572 74.6


line true false branch
80 1 931 if $self->_has_uploadtmp
83 4 928 if $self->config->{'use_hash_multivalue_in_request'}
89 934 161 if $class->_composed_request_class
91 159 2 unless $class->request_class_traits
161 0 unless $class->config->{'request_class_traits'}
102 0 7 if ($class->debug and scalar @normalized_traits)
132 933 161 if $class->_composed_response_class
134 160 1 unless $class->response_class_traits
161 0 unless $class->config->{'response_class_traits'}
141 0 7 if ($class->debug and scalar @normalized_traits)
153 0 9205 unless (shift())->stack
191 1 161 if $class->_composed_stats_class
193 160 1 unless $class->stats_class_traits
161 0 unless $class->config->{'stats_class_traits'}
200 0 7 if ($class->debug and scalar @normalized_traits)
217 148 165 unless $class eq "Catalyst"
220 8 157 if $caller eq "main"
223 148 9 unless ($caller->isa("Catalyst"))
230 149 8 unless ($meta->has_method("meta"))
231 149 0 if ($Moose::VERSION >= 1.15) { }
602 0 2414 unless &blessed($c)
629 39 10981 if ($_[0]) { }
10 10971 elsif (defined $_[0]) { }
630 0 39 ref $_[0] eq 'ARRAY' ? :
631 0 39 unless ref $c
671 6 286 scalar @{(shift())->error;} ? :
683 0 0 scalar @errs ? :
733 6 61 unless defined $name
735 9 52 $name->$Catalyst::_isa('Regexp') ? :
738 41 20 if @result
741 1 19 if $name->$Catalyst::_isa("Regexp")
745 1 18 if $appclass->config->{'disable_component_resolution_regex_fallback'}
752 14 4 unless (@result)
757 14 4 if (@result)
767 0 14 if ($shortmess =~ m[Catalyst/Plugin]) { }
0 14 elsif ($shortmess =~ m[Catalyst/lib/(View|Controller)]) { }
802 9 16542 if (ref $comp eq "CODE")
806 9 16542 if (eval {
810 0 16542 if scalar @args and $c->debug
838 61 10 if ($name)
839 58 3 unless ($name->$Catalyst::_isa("Regexp"))
842 45 13 if exists $comps->{$check}
844 1 1 unless $path =~ /.*::Controller/
846 1 0 if exists $comps->{$check}
850 3 12 if ref $name
882 49 2 if ($name)
883 46 3 unless ($name->$Catalyst::_isa("Regexp"))
886 30 16 if exists $comps->{$check}
888 0 0 unless $path =~ /.*::Model/
890 0 0 if exists $comps->{$check}
894 5 14 if ref $name
898 0 2 if (ref $c)
900 0 0 if $c->stash->{'current_model_instance'}
902 0 0 if $c->stash->{'current_model'}
905 1 1 if $appclass->config->{'default_model'}
909 1 0 if ($rest)
946 27 4 if ($name)
947 24 3 unless ($name->$Catalyst::_isa("Regexp"))
950 12 12 if (exists $comps->{$check}) { }
957 0 0 unless $path =~ /.*::View/
959 0 0 if exists $comps->{$check}
963 3 12 if ref $name
967 2 2 if (ref $c)
969 0 2 if $c->stash->{'current_view_instance'}
971 0 2 if $c->stash->{'current_view'}
974 2 2 if $appclass->config->{'default_view'}
978 1 1 if ($rest)
1046 16411 1 if ($name)
1049 16408 3 unless (ref $name)
1052 16378 30 if exists $comps->{$name}
1057 18 12 if exists $comps->{$composed}
1061 10 2 if $comp
1065 0 5 if $c->config->{'disable_component_resolution_regex_fallback'}
1068 3 2 ref $name ? :
1071 3 2 if ref $name
1073 0 2 if ($result[0])
1193 0 0 (shift())->encoding ? :
1197 2 0 if (&blessed($c)) { }
1208 172 4742 if (scalar @_) { }
1211 1 171 if (&blessed($c) and $c->res->finalized_headers)
1217 167 4 if (my $wanted = shift()) { }
1218 0 167 unless $encoding = &Encode::find_encoding($wanted)
1227 9 162 ref $c ? :
1232 85 4657 ref $c && exists $c->{'encoding'} ? :
1291 7 11 if (-d $path) { }
1308 0 1 if ($@)
1314 0 1 if $class->debug
1346 0 162 if $class->setup_finished
1349 0 162 unless ($class->isa("Catalyst"))
1355 156 6 if ($class->arguments)
1364 3 652 if (/^-Debug$/) { }
9 643 elsif (/^-(\w+)=?(.*)$/) { }
1366 0 3 $flags->{'log'} ? :
1383 0 162 if (my $engine = delete $flags->{'engine'})
1391 0 0 if (my $code = $class->can('setup_' . $flag)) { }
1400 0 0 if (not $@ and $ENV{'CATALYST_SCRIPT_GEN'} and $ENV{'CATALYST_SCRIPT_GEN'} < $Catalyst::Devel::CATALYST_SCRIPT_GEN)
1418 162 0 unless $Catalyst::__AM_RESTARTING
1433 7 155 if ($class->debug)
1436 0 7 if (@plugins)
1444 0 49 ref $_ eq 'CODE' ? :
1449 7 0 if (@middleware)
1457 7 0 if (my(@data_handlers) = keys %dh)
1471 1 0 -d $home ? :
1 6 $home ? :
1481 5 0 ref $class->components->{$comp} ? :
1485 5 2 if keys %{$class->components;}
1489 142 20 if ($class->isa("Catalyst::Controller"))
1495 7 154 if ($class->debug)
1500 0 161 if ($class->config->{'case_sensitive'})
1513 148 13 if $class->log->can("_flush")
1607 1 121 if ($path->$Catalyst::_isa("Catalyst::Controller"))
1613 2 120 scalar @args && ref $args[-1] eq 'SCALAR' ? :
1615 47 75 unless (&blessed($path))
1616 5 42 if (defined $path and $path =~ s/#(.+)$//)
1617 0 5 if (defined $1 and defined $fragment)
1620 5 0 if (defined $1)
1626 38 84 scalar @args && ref $args[$#args] eq 'HASH' ? :
1629 1 121 if defined $path and $path eq ""
1631 0 122 if grep {not defined $_;} @args
1633 73 49 $path->$Catalyst::_isa('Catalyst::Action') ? :
1634 73 49 if ($path->$Catalyst::_isa("Catalyst::Action"))
1638 53 20 scalar @args && ref $args[0] eq 'ARRAY' ? :
1646 22 20 if (not @args and $action->number_of_args and @$captures > $num_captures)
1650 47 26 if ($num_captures)
1651 3 44 unless ($expanded_action->match_captures_constraints($c, $captures))
1652 0 3 if $c->debug
1659 3 67 unless (defined $path)
1660 0 3 if $c->debug
1664 0 67 if $path eq ""
1667 10 57 if ($expanded_action->has_args_constraints)
1668 3 7 unless ($expanded_action->match_args($c, \@args))
1669 0 3 if $c->debug
1678 18 95 unless (defined $path and $path =~ s[^/][])
1680 16 2 if (defined $path)
1692 104 9 if (&blessed($c))
1694 61 43 if ($target_action) { }
1696 3 58 if (my $s = $target_action->scheme) { }
1711 34 79 if (my(@keys) = keys %$params)
1720 1 36 unless defined $val
1722 1 36 ref $val eq 'ARRAY' ? :
1737 7 106 if (defined $fragment)
1738 1 6 if (&blessed($path))
1812 2 29 &blessed($path) ? :
1815 1 30 unless (defined $action)
2043 1 9111 if ($c->depth >= $RECURSION)
2045 1 0 unless $action =~ /->/
2053 111 9000 if $c->use_stats
2062 29 9079 if $c->use_stats and $stats_info
2066 123 8985 if (my $error = $@)
2068 9 114 if ($c->_handle_http_exception($error))
2073 9 0 if $c->log->can("_flush")
2075 0 9 $error->can('rethrow') ? :
2077 27 87 if (&blessed($error) and $error->isa('Catalyst::Exception::Detach')) { }
66 21 elsif (&blessed($error) and $error->isa('Catalyst::Exception::Go')) { }
2078 13 14 if $c->depth > 1
2081 55 11 if $c->depth > 0
2084 13 8 unless (ref $error)
2102 82 29 if $code->name =~ /^_.*/ and not $appclass->config->{'show_internal_actions'}
2108 29 0 unless $action =~ /->/
2116 24 87 if (caller $index)[0] eq "Catalyst" and (caller $index)[3] eq "(eval)"
2119 5 82 if ((caller $index)[3] =~ /forward$/)
2129 5 24 if ($callsub =~ /forward$/) { }
2133 4 1 if (defined $parent and exists $c->counter->{"$parent"}) { }
2182 0 918 if ($c->request->_has_io_fh)
2189 0 918 if (my $code = $engine->can('finalize')) { }
2197 34 884 if ($#{$c->error;} >= 0)
2202 901 17 unless $c->response->finalized_headers
2208 15 903 if $c->use_stats
2223 0 15 $elapsed == 0 ? :
2256 3 31 if ($#{$c->error;} > 0) { }
2260 0 31 if ($c->_handle_http_exception($error)) { }
2263 0 0 $error->can('rethrow') ? :
2282 0 918 if $response->finalized_headers
2285 14 904 if (my $location = $response->redirect)
2286 0 14 if $c->debug
2324 2 89 if ($res->content_type_charset and $c->encoding and uc $c->encoding->mime_name ne uc $res->content_type_charset)
2334 203 19 if ($res->encodable_response and defined $res->body and ref \$res->body eq "SCALAR")
2349 159 1 unless $c->res->content_type_charset or $c->res->_context and $c->res->finalized_headers and not $c->res->_has_response_cb
2404 16 907 if ($class->debug)
2416 4 4 if ($class->_handle_http_exception($_))
2417 0 4 $_->can('rethrow') ? :
2425 867 51 if (my $coderef = $class->log->can("_flush"))
2449 127 796 unless $class->context_class
2452 1 922 $uploadtmp ? :
2457 16 907 if ($c->debug or $c->config->{'enable_catalyst_header'})
2463 0 923 if (my $prepare = $c->engine->can('prepare')) { }
2479 919 3 unless (ref($c)->config->{'parse_on_demand'})
2495 1 4 if ($c->_handle_http_exception($_)) { }
2500 1 0 if $c->log->can("_flush")
2501 0 1 $_->can('rethrow') ? :
2528 919 1 if ($c->encoding)
2547 101 920 if $c->request->_has_body
2661 902 16 unless $c->debug
2668 1 15 unless length $path
2678 0 16 if (my $keywords = $request->query_keywords)
2682 16 0 $request->_has_body ? :
2697 905 13 unless $c->debug
2754 0 16 unless $c->debug
2759 32 0 unless keys %$params
2763 0 0 if (ref $params eq 'Hash::MultiValue') { }
2767 0 0 if (defined $param)
2768 0 0 ref $param eq 'ARRAY' ? :
2771 0 0 scalar @values > 1 ? :
2788 0 16 unless $c->debug
2790 0 16 if (keys %$uploads)
2799 0 0 ref $upload eq 'ARRAY' ? :
2827 0 0 unless $c->debug
2965 0 1 $app->engine_loader->needs_psgi_engine_compat_hack ? :
2974 1 0 if ($meta->is_immutable and not {$meta->immutable_options}->{'replace_constructor'} and $isa_ca)
2985 2 1 unless ($meta->is_immutable)
3033 3 159 if $deprecatedcatalyst_component_names
3059 6699 0 if (ref $class->components->{$component_name} || '') eq "CODE"
3071 161 1 unless $class->config->{'inject_components'}
3091 5 0 if (my $component_class = $config->{'from_component'})
3092 4 1 unless $config->{'roles'}
3093 1 4 scalar @roles ? :
3149 0 2 if $app->config->{'inject_components'}{$name}
3223 238 6951 unless ($component->can("COMPONENT"))
3243 0 6951 unless (&blessed($instance))
3247 0 0 defined $instance ? :
3254 6951 0 $instance->can('expand_modules') ? :
3258 6480 475 if $class->components->{$component}
3301 0 162 if ($dispatcher)
3305 0 162 if (my $env = Catalyst::Utils::env_value($class, "DISPATCHER"))
3309 162 0 unless ($dispatcher)
3328 0 0 if (not $class->engine_loader or $requested_engine)
3329 0 0 defined $requested_engine ? :
3347 162 0 if (not $loader or $requested_engine)
3348 0 162 defined $requested_engine ? :
3361 0 162 if $class->loading_psgi_file
3365 0 162 if ($ENV{'MOD_PERL'})
3371 0 0 if $was_immutable
3379 0 0 if $was_immutable
3395 121 787 unless ($app->_psgi_app)
3417 88 2 unless -e $psgi_file
3429 2 0 unless $app->engine_loader->needs_psgi_engine_compat_hack
3483 121 0 unless ($app->config->{'using_frontend_proxy'})
3489 1 907 if $app->config->{'ignore_frontend_proxy'}
3502 907 1 unless $env->{'SERVER_SOFTWARE'} and $env->{'SERVER_SOFTWARE'} =~ m[lighttpd[-/]1\.(\d+\.\d+)]
3503 0 1 unless $1 < "4.23"
3569 2 317 if (my $env = Catalyst::Utils::env_value($class, "HOME"))
3575 219 100 if ($home)
3590 1 161 if (exists $c->config->{'encoding'} and not defined $c->config->{'encoding'}) { }
3595 81 80 defined $c->config->{'encoding'} ? :
3654 0 120 unless defined $value
3657 3 117 if (ref $value eq 'ARRAY') { }
36 81 elsif (ref $value eq 'HASH') { }
3670 5 28 if $_ ne $encoded_key
3681 0 1217 unless defined $value
3682 0 1217 if &blessed($value)
3686 4 1213 unless $enc
3726 4 170 if (defined $env_debug)
3727 1 3 if $env_debug
3728 3 1 unless $env_debug
3731 150 24 unless ($class->log)
3735 5 169 if ($levels{'debug'})
3759 2 165 defined $env ? :
11 156 if (defined $env ? $env : $stats || $class->debug)
3785 627 7 unless @_
3787 3 4 if exists $proto->_plugins->{$plugin}
3796 0 564 if $plugin->isa("Catalyst::Component")
3799 1 561 if (not $plugin_meta->has_method("new") and $plugin->isa('Class::Accessor::Fast') || $plugin->isa('Class::Accessor'))
3803 563 0 unless ($instant or $proto->_plugins->{$plugin})
3816 162 0 unless $class->_plugins
3818 0 643 /Unicode::Encoding/ ? :
3824 0 0 unless (exists $class->config->{'encoding'})
3845 79 563 if $meta and $meta->isa("Moose::Meta::Role")
3852 642 0 if &blessed($_->[0])
3856 79 83 if @roles
3909 0 142 if ($class->config->{'using_frontend_proxy'})
3913 0 142 if ($class->config->{'using_frontend_proxy_path'})
3914 0 0 if (Class::Load::try_load_class('Plack::Middleware::ReverseProxyPath')) { }
3964 142 0 if (my $middleware = $class->_psgi_middleware) { }
3967 0 142 if ($class->config->{'using_frontend_proxy'})
3983 2 164 if (@_) { }
3986 159 3 unless $class->config->{'psgi_middleware'}
162 2 unless $class->finalized_default_middleware
3993 8 6 if (ref $next) { }
3994 2 6 if (&Scalar::Util::blessed($next) and $next->can('wrap')) { }
2 4 elsif (ref $next eq 'CODE') { }
4 0 elsif (ref $next eq 'HASH') { }
4011 162 3 unless $class->_psgi_middleware
4052 939 0 if (my $data_handlers = $class->_data_handlers) { }
4064 162 0 unless $class->config->{'data_handlers'}
4075 0 1 $req->_use_hash_multivalue ? :
4094 14 100 if (not $self->config->{'always_catch_http_exceptions'} and &blessed($error) and $error->can('as_psgi') || $error->can('code') && $error->code =~ /^[1-5][0-9][0-9]$/)