Branch Coverage

blib/lib/MVC/Neaf/Route/Main.pm
Criterion Covered Total %
branch 207 234 88.4


line true false branch
53 877 2 if ref $self
58 1 1 if ($self eq "MVC::Neaf")
82 1 95 if %opt
223 1 116 if @_ % 2
228 2 113 unless UNIVERSAL::isa($sub, "CODE")
233 1 112 if $args{'default'} and ref $args{'default'} ne "HASH"
241 1 111 if @extra
250 1 110 if $args{'public'} and not $args{'description'}
260 15 91 defined $args{'path_info_regex'} ? :
264 1 105 $args{'public'} ? :
267 1 105 if (exists $args{'view'})
275 11 95 if $args{'default'}{'-view'}
299 10 144 if exists $self->{'route'}{$path}{$_}
302 7 110 if (@dupe)
316 2 5 if ($profile->{'override'}) { }
1 4 elsif ($profile->{'tentative'}) { }
432 1 4 if (ref $dir eq "ARRAY")
481 1 2 unless $self->{'route'}{$old}
487 1 0 length $new ? :
1 1 if $self->{'route'}{$new}
529 1 104 if (@_ == 2)
536 1 104 unless ref $values eq "HASH"
638 1 34 unless UNIVERSAL::isa($code, "CODE")
641 1 33 unless $hook_phases{$phase}
644 11 22 if ($phase eq "pre_route")
647 2 9 if defined $opt{'path'} or defined $opt{'exclude'}
681 3 198 if (my $key = $self->{'session_view_as'})
687 4 197 if (my $force_view = $self->{'force_view'})
704 1 17 unless ref $code and UNIVERSAL::isa($code, "CODE")
715 10 7 if $MVC::Neaf::Request::allow_helper{$name}
717 2 5 if not $name =~ /^[a-z][a-z_0-9]*/ or $name =~ /^(?:do|neaf)/
720 1 4 if "MVC::Neaf::Request"->can($name)
727 1 8 unless $code
755 26 3 if $last
803 2 38 unless defined $name and defined $obj
807 36 2 unless (ref $obj)
812 34 2 unless ($obj->can("new"))
813 0 34 unless eval { do { &load($obj); 1 } }
819 1 37 unless &blessed($obj) and $obj->can("render") or ref $obj eq "CODE"
845 0 2 unless $view
864 1 2 if (@_) { }
931 2 11 if (not ref $file and defined $file)
932 0 2 unless open my $fd, "<", $file
940 1 12 if defined $name and $self->{'load_resources'}{$name}++
944 6 6 if (ref $file eq 'GLOB') { }
5 1 elsif (ref $file eq 'SCALAR') { }
947 0 6 unless defined $content
957 1 10 unless defined $content
964 0 10 if @parts % 2
976 0 17 unless defined $name
979 1 16 if ($dest)
985 1 16 if (my(@unknown) = grep({not $load_resources_opt{$_};} keys %opt))
991 13 3 if (not $opt{'format'}) { }
3 0 elsif ($opt{'format'} eq 'base64') { }
1003 9 7 if (defined(my $view = $opt{'view'})) { }
1006 0 9 if defined $templates{$view}{$name}
1011 1 6 if $static{$name}
1019 2 4 if (not $view) { }
3 1 elsif ($view->can('preload')) { }
1027 5 4 if (%static)
1097 0 5 unless $sess
1100 2 3 unless (ref $sess)
1103 0 2 unless my $obj = eval { do { &load($sess); $sess->new(%opt) } }
1112 0 5 if @missing
1171 0 9 unless $status =~ /^(?:\d\d\d)$/
1175 2 7 if (ref $code eq "HASH")
1183 0 9 unless &reftype($code) eq "CODE"
1213 1 0 if (defined $code) { }
1214 0 1 unless ref $code eq "CODE"
1259 17 251 unless $node->{'GET'}
1327 174 2 if ($self->{'magic'})
1329 3 171 if $data
1333 6 170 unless (defined wantarray)
1335 5 1 if (@ARGV) { }
1342 1 0 unless defined $ENV{'SCRIPT_NAME'}
1410 0 135 if @extra
1413 130 5 unless (ref $env)
1415 35 95 defined $2 ? :
1428 18 117 if $opt{'method'}
1431 4 131 if (my $head = $opt{'header'})
1438 1 134 if (exists $opt{'secure'})
1439 1 0 $opt{'secure'} ? :
1441 14 121 if (my $cook = $opt{'cookie'})
1442 12 2 if (ref $cook eq "HASH")
1448 0 14 $env->{'HTTP_COOKIE'} ? :
1451 6 129 if (my $body = $opt{'body'})
1452 0 6 unless open my $dummy, "<", \$body
1457 1 134 if (my $type = $opt{'type'})
1458 1 0 if $type eq "?"
1460 1 0 $opt{'type'} eq '?' ? :
1470 5 130 if (ref $ret eq "CODE")
1516 33 15 unless $route->is_locked
1520 42 6 if $filtered
1565 2 111 if (my $hooks = $req->route->hooks->{'pre_content'})
1572 53 60 unless defined $hash->{'-content'}
1576 48 109 unless ($data)
1608 14 65 if ref $view
1613 28 31 unless $lazy or $self->{'seen_view'}{$view}
1656 6 151 unless $path =~ /$self->{'route_re'}/
1661 4 147 unless my $node = $self->{'route'}{$prefix}
1665 4 143 unless ($route)
1672 92 51 unless defined $postfix
1693 0 157 unless $self->{'lock'}
1707 10 147 if $pre_route_hooks
1731 11 45 if $route->hooks->{'pre_render'}
1735 55 0 &blessed($view) ? :
1741 4 52 unless (defined $content)
1756 38 10 if (not &blessed($err)) { }
1 9 elsif (not $err->isa('MVC::Neaf::Exception')) { }
1774 1 9 if ($err->is_sudden and exists $self->{'on_error'})
1775 0 1 unless eval { do { $self->{'on_error'}->($req, $err, $req->endpoint_origin); 1 } }
1783 9 39 if (my $tpl = $self->_get_error_handler($err->status, $req))
1794 8 1 if $ret
1801 9 31 if $err->is_sudden
1810 38 10 unless $store
1827 38 0 if (defined $file and -f $file)
1830 2 36 $file =~ /(.*)\.pm$/ ? :