Branch Coverage

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


line true false branch
80 1 938 if $self->_has_uploadtmp
83 4 935 if $self->config->{'use_hash_multivalue_in_request'}
89 941 163 if $class->_composed_request_class
91 161 2 unless $class->request_class_traits
163 0 unless $class->config->{'request_class_traits'}
102 0 7 if ($class->debug and scalar @normalized_traits)
132 940 163 if $class->_composed_response_class
134 162 1 unless $class->response_class_traits
163 0 unless $class->config->{'response_class_traits'}
141 0 7 if ($class->debug and scalar @normalized_traits)
153 0 9258 unless (shift())->stack
191 1 163 if $class->_composed_stats_class
193 162 1 unless $class->stats_class_traits
163 0 unless $class->config->{'stats_class_traits'}
200 0 7 if ($class->debug and scalar @normalized_traits)
217 150 167 unless $class eq "Catalyst"
220 8 159 if $caller eq "main"
223 150 9 unless ($caller->isa("Catalyst"))
230 151 8 unless ($meta->has_method("meta"))
231 151 0 if ($Moose::VERSION >= 1.15) { }
609 0 2425 unless &blessed($c)
636 39 11048 if ($_[0]) { }
10 11038 elsif (defined $_[0]) { }
637 0 39 ref $_[0] eq 'ARRAY' ? :
638 0 39 unless ref $c
678 6 295 scalar @{(shift())->error;} ? :
690 0 0 scalar @errs ? :
740 6 61 unless defined $name
742 9 52 $name->$Catalyst::_isa('Regexp') ? :
745 41 20 if @result
748 1 19 if $name->$Catalyst::_isa("Regexp")
752 1 18 if $appclass->config->{'disable_component_resolution_regex_fallback'}
759 14 4 unless (@result)
764 14 4 if (@result)
774 0 14 if ($shortmess =~ m[Catalyst/Plugin]) { }
0 14 elsif ($shortmess =~ m[Catalyst/lib/(View|Controller)]) { }
809 9 16595 if (ref $comp eq "CODE")
813 11 16593 if (eval {
817 0 16593 if scalar @args and $c->debug
845 61 10 if ($name)
846 58 3 unless ($name->$Catalyst::_isa("Regexp"))
849 45 13 if exists $comps->{$check}
851 1 1 unless $path =~ /.*::Controller/
853 1 0 if exists $comps->{$check}
857 3 12 if ref $name
889 49 2 if ($name)
890 46 3 unless ($name->$Catalyst::_isa("Regexp"))
893 30 16 if exists $comps->{$check}
895 0 0 unless $path =~ /.*::Model/
897 0 0 if exists $comps->{$check}
901 5 14 if ref $name
905 0 2 if (ref $c)
907 0 0 if $c->stash->{'current_model_instance'}
909 0 0 if $c->stash->{'current_model'}
912 1 1 if $appclass->config->{'default_model'}
916 1 0 if ($rest)
953 29 4 if ($name)
954 26 3 unless ($name->$Catalyst::_isa("Regexp"))
957 14 12 if (exists $comps->{$check}) { }
964 0 0 unless $path =~ /.*::View/
966 0 0 if exists $comps->{$check}
970 3 12 if ref $name
974 2 2 if (ref $c)
976 0 2 if $c->stash->{'current_view_instance'}
978 0 2 if $c->stash->{'current_view'}
981 2 2 if $appclass->config->{'default_view'}
985 1 1 if ($rest)
1053 16464 1 if ($name)
1056 16459 5 unless (ref $name)
1059 16429 30 if exists $comps->{$name}
1064 18 12 if exists $comps->{$composed}
1068 10 2 if $comp
1072 0 7 if $c->config->{'disable_component_resolution_regex_fallback'}
1075 5 2 ref $name ? :
1078 5 2 if ref $name
1080 0 2 if ($result[0])
1200 0 0 (shift())->encoding ? :
1204 2 0 if (&blessed($c)) { }
1215 174 4764 if (scalar @_) { }
1218 1 173 if (&blessed($c) and $c->res->finalized_headers)
1224 169 4 if (my $wanted = shift()) { }
1225 0 169 unless $encoding = &Encode::find_encoding($wanted)
1234 9 164 ref $c ? :
1239 85 4679 ref $c && exists $c->{'encoding'} ? :
1298 7 11 if (-d $path) { }
1315 0 1 if ($@)
1321 0 1 if $class->debug
1353 0 164 if $class->setup_finished
1356 0 164 unless ($class->isa("Catalyst"))
1362 158 6 if ($class->arguments)
1371 3 652 if (/^-Debug$/) { }
9 643 elsif (/^-(\w+)=?(.*)$/) { }
1373 0 3 $flags->{'log'} ? :
1390 0 164 if (my $engine = delete $flags->{'engine'})
1398 0 0 if (my $code = $class->can('setup_' . $flag)) { }
1407 0 0 if (not $@ and $ENV{'CATALYST_SCRIPT_GEN'} and $ENV{'CATALYST_SCRIPT_GEN'} < $Catalyst::Devel::CATALYST_SCRIPT_GEN)
1425 164 0 unless $Catalyst::__AM_RESTARTING
1440 7 157 if ($class->debug)
1443 0 7 if (@plugins)
1451 0 49 ref $_ eq 'CODE' ? :
1456 7 0 if (@middleware)
1464 7 0 if (my(@data_handlers) = keys %dh)
1478 1 0 -d $home ? :
1 6 $home ? :
1488 5 0 ref $class->components->{$comp} ? :
1492 5 2 if keys %{$class->components;}
1496 144 20 if ($class->isa("Catalyst::Controller"))
1502 7 156 if ($class->debug)
1507 0 163 if ($class->config->{'case_sensitive'})
1520 150 13 if $class->log->can("_flush")
1614 1 121 if ($path->$Catalyst::_isa("Catalyst::Controller"))
1620 2 120 scalar @args && ref $args[-1] eq 'SCALAR' ? :
1622 47 75 unless (&blessed($path))
1623 5 42 if (defined $path and $path =~ s/#(.+)$//)
1624 0 5 if (defined $1 and defined $fragment)
1627 5 0 if (defined $1)
1633 38 84 scalar @args && ref $args[$#args] eq 'HASH' ? :
1636 1 121 if defined $path and $path eq ""
1638 0 122 if grep {not defined $_;} @args
1640 73 49 $path->$Catalyst::_isa('Catalyst::Action') ? :
1641 73 49 if ($path->$Catalyst::_isa("Catalyst::Action"))
1645 53 20 scalar @args && ref $args[0] eq 'ARRAY' ? :
1653 22 20 if (not @args and $action->number_of_args and @$captures > $num_captures)
1657 47 26 if ($num_captures)
1658 3 44 unless ($expanded_action->match_captures_constraints($c, $captures))
1659 0 3 if $c->debug
1666 3 67 unless (defined $path)
1667 0 3 if $c->debug
1671 0 67 if $path eq ""
1674 10 57 if ($expanded_action->has_args_constraints)
1675 3 7 unless ($expanded_action->match_args($c, \@args))
1676 0 3 if $c->debug
1685 18 95 unless (defined $path and $path =~ s[^/][])
1687 16 2 if (defined $path)
1699 104 9 if (&blessed($c))
1701 61 43 if ($target_action) { }
1703 3 58 if (my $s = $target_action->scheme) { }
1718 34 79 if (my(@keys) = keys %$params)
1727 1 36 unless defined $val
1729 1 36 ref $val eq 'ARRAY' ? :
1744 7 106 if (defined $fragment)
1745 1 6 if (&blessed($path))
1819 2 29 &blessed($path) ? :
1822 1 30 unless (defined $action)
2050 1 9164 if ($c->depth >= $RECURSION)
2052 1 0 unless $action =~ /->/
2060 111 9053 if $c->use_stats
2069 29 9132 if $c->use_stats and $stats_info
2073 123 9038 if (my $error = $@)
2075 9 114 if ($c->_handle_http_exception($error))
2080 9 0 if $c->log->can("_flush")
2082 0 9 $error->can('rethrow') ? :
2084 27 87 if (&blessed($error) and $error->isa('Catalyst::Exception::Detach')) { }
66 21 elsif (&blessed($error) and $error->isa('Catalyst::Exception::Go')) { }
2085 13 14 if $c->depth > 1
2088 55 11 if $c->depth > 0
2091 13 8 unless (ref $error)
2109 82 29 if $code->name =~ /^_.*/ and not $appclass->config->{'show_internal_actions'}
2115 29 0 unless $action =~ /->/
2123 24 95 if (caller $index)[0] eq "Catalyst" and (caller $index)[3] eq "(eval)"
2126 5 90 if ((caller $index)[3] =~ /forward$/)
2136 5 24 if ($callsub =~ /forward$/) { }
2140 4 1 if (defined $parent and exists $c->counter->{"$parent"}) { }
2189 0 925 if ($c->request->_has_io_fh)
2196 0 925 if (my $code = $engine->can('finalize')) { }
2204 34 891 if ($#{$c->error;} >= 0)
2209 908 17 unless $c->response->finalized_headers
2215 15 910 if $c->use_stats
2230 0 15 $elapsed == 0 ? :
2263 3 31 if ($#{$c->error;} > 0) { }
2267 0 31 if ($c->_handle_http_exception($error)) { }
2270 0 0 $error->can('rethrow') ? :
2289 0 925 if $response->finalized_headers
2292 14 911 if (my $location = $response->redirect)
2293 0 14 if $c->debug
2331 2 89 if ($res->content_type_charset and $c->encoding and uc $c->encoding->mime_name ne uc $res->content_type_charset)
2341 203 19 if ($res->encodable_response and defined $res->body and ref \$res->body eq "SCALAR")
2356 159 1 unless $c->res->content_type_charset or $c->res->_context and $c->res->finalized_headers and not $c->res->_has_response_cb
2411 16 914 if ($class->debug)
2423 4 4 if ($class->_handle_http_exception($_))
2424 0 4 $_->can('rethrow') ? :
2432 874 51 if (my $coderef = $class->log->can("_flush"))
2456 129 801 unless $class->context_class
2459 1 929 $uploadtmp ? :
2464 16 914 if ($c->debug or $c->config->{'enable_catalyst_header'})
2470 0 930 if (my $prepare = $c->engine->can('prepare')) { }
2486 926 3 unless (ref($c)->config->{'parse_on_demand'})
2502 1 4 if ($c->_handle_http_exception($_)) { }
2507 1 0 if $c->log->can("_flush")
2508 0 1 $_->can('rethrow') ? :
2535 926 1 if ($c->encoding)
2554 101 927 if $c->request->_has_body
2668 909 16 unless $c->debug
2675 1 15 unless length $path
2685 0 16 if (my $keywords = $request->query_keywords)
2689 16 0 $request->_has_body ? :
2704 912 13 unless $c->debug
2761 0 16 unless $c->debug
2766 32 0 unless keys %$params
2770 0 0 if (ref $params eq 'Hash::MultiValue') { }
2774 0 0 if (defined $param)
2775 0 0 ref $param eq 'ARRAY' ? :
2778 0 0 scalar @values > 1 ? :
2795 0 16 unless $c->debug
2797 0 16 if (keys %$uploads)
2806 0 0 ref $upload eq 'ARRAY' ? :
2834 0 0 unless $c->debug
2972 0 1 $app->engine_loader->needs_psgi_engine_compat_hack ? :
2981 1 0 if ($meta->is_immutable and not {$meta->immutable_options}->{'replace_constructor'} and $isa_ca)
2992 2 1 unless ($meta->is_immutable)
3039 3 161 if $deprecatedcatalyst_component_names
3065 6704 0 if (ref $class->components->{$component_name} || '') eq "CODE"
3077 163 1 unless $class->config->{'inject_components'}
3097 5 0 if (my $component_class = $config->{'from_component'})
3098 4 1 unless $config->{'roles'}
3099 1 4 scalar @roles ? :
3155 0 2 if $app->config->{'inject_components'}{$name}
3229 238 6956 unless ($component->can("COMPONENT"))
3249 0 6956 unless (&blessed($instance))
3253 0 0 defined $instance ? :
3260 6956 0 $instance->can('expand_modules') ? :
3264 6480 475 if $class->components->{$component}
3307 0 164 if ($dispatcher)
3311 0 164 if (my $env = Catalyst::Utils::env_value($class, "DISPATCHER"))
3315 164 0 unless ($dispatcher)
3334 0 0 if (not $class->engine_loader or $requested_engine)
3335 0 0 defined $requested_engine ? :
3353 164 0 if (not $loader or $requested_engine)
3354 0 164 defined $requested_engine ? :
3367 0 164 if $class->loading_psgi_file
3371 0 164 if ($ENV{'MOD_PERL'})
3377 0 0 if $was_immutable
3385 0 0 if $was_immutable
3401 123 792 unless ($app->_psgi_app)
3423 88 2 unless -e $psgi_file
3435 2 0 unless $app->engine_loader->needs_psgi_engine_compat_hack
3489 123 0 unless ($app->config->{'using_frontend_proxy'})
3495 1 914 if $app->config->{'ignore_frontend_proxy'}
3508 914 1 unless $env->{'SERVER_SOFTWARE'} and $env->{'SERVER_SOFTWARE'} =~ m[lighttpd[-/]1\.(\d+\.\d+)]
3509 0 1 unless $1 < "4.23"
3575 2 321 if (my $env = Catalyst::Utils::env_value($class, "HOME"))
3581 219 104 if ($home)
3596 1 163 if (exists $c->config->{'encoding'} and not defined $c->config->{'encoding'}) { }
3601 81 82 defined $c->config->{'encoding'} ? :
3660 0 120 unless defined $value
3663 3 117 if (ref $value eq 'ARRAY') { }
36 81 elsif (ref $value eq 'HASH') { }
3676 5 28 if $_ ne $encoded_key
3687 0 1218 unless defined $value
3688 0 1218 if &blessed($value)
3692 4 1214 unless $enc
3732 4 172 if (defined $env_debug)
3733 1 3 if $env_debug
3734 3 1 unless $env_debug
3737 152 24 unless ($class->log)
3741 5 171 if ($levels{'debug'})
3765 2 167 defined $env ? :
11 158 if (defined $env ? $env : $stats || $class->debug)
3791 627 7 unless @_
3793 3 4 if exists $proto->_plugins->{$plugin}
3802 0 564 if $plugin->isa("Catalyst::Component")
3805 1 561 if (not $plugin_meta->has_method("new") and $plugin->isa('Class::Accessor::Fast') || $plugin->isa('Class::Accessor'))
3809 563 0 unless ($instant or $proto->_plugins->{$plugin})
3822 164 0 unless $class->_plugins
3824 0 643 /Unicode::Encoding/ ? :
3830 0 0 unless (exists $class->config->{'encoding'})
3851 79 563 if $meta and $meta->isa("Moose::Meta::Role")
3858 642 0 if &blessed($_->[0])
3862 79 85 if @roles
3915 0 144 if ($class->config->{'using_frontend_proxy'})
3919 0 144 if ($class->config->{'using_frontend_proxy_path'})
3920 0 0 if (Class::Load::try_load_class('Plack::Middleware::ReverseProxyPath')) { }
3970 144 0 if (my $middleware = $class->_psgi_middleware) { }
3973 0 144 if ($class->config->{'using_frontend_proxy'})
3989 2 166 if (@_) { }
3992 161 3 unless $class->config->{'psgi_middleware'}
164 2 unless $class->finalized_default_middleware
3999 8 6 if (ref $next) { }
4000 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') { }
4017 164 3 unless $class->_psgi_middleware
4058 946 0 if (my $data_handlers = $class->_data_handlers) { }
4070 164 0 unless $class->config->{'data_handlers'}
4081 0 1 $req->_use_hash_multivalue ? :
4100 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]$/)