Branch Coverage

blib/lib/Sub/MultiMethod.pm
Criterion Covered Total %
branch 168 242 69.4


line true false branch
72 68 382 unless ($CANDIDATES{$target})
86 12 398 ref $method_name ? :
96 0 4 ref $method_name ? :
119 0 226 if (@$mmc and $spec->{'method'} != $mmc->[0]{'method'})
145 2 36 if (is_Int($method_name) or is_ScalarRef($method_name)) { }
151 32 4 $is_method ? :
164 56 38 if ($found) { }
38 0 elsif (not $is_coderef_method) { }
169 4 34 if (exists &{"${p}::$method_name";})
172 4 0 unless ($me->known_dispatcher($coderef))
187 4 34 if (defined $final_fallback)
222 0 80 if (ref $target or not defined $target)
227 0 80 unless $args->{'defaults'}
239 0 106 if (@_ % 2 == 1)
240 0 0 if (is_CodeRef($_[-1])) { }
250 0 106 if exists $spec{'pos'}
251 0 106 if exists $spec{'multi'}
254 0 0 if (is_ArrayRef($sig)) { }
0 0 elsif (is_HashRef($sig)) { }
255 0 0 if ($spec{'positional'}) { }
264 0 0 if ($spec{'named'}) { }
274 0 2 if ($spec{'named'} and $spec{'positional'})
281 0 106 if (@tmp_code)
282 0 0 if ($spec{'code'})
289 0 0 unless (exists $spec{'code'} or exists $spec{'return'} or exists $spec{'die'})
294 0 106 if (ref $spec{'return'})
299 46 60 if ($defaults{'no_dispatcher'} eq "auto")
303 12 94 ref $sub_name ? :
316 46 0 unless exists $args->{'defaults'}{'no_dispatcher'}
317 46 0 unless exists $args->{'defaults'}{'method'}
323 12 0 unless exists $args->{'defaults'}{'no_dispatcher'}
324 12 0 unless exists $args->{'defaults'}{'method'}
331 12 0 unless exists $args->{'defaults'}{'no_dispatcher'}
332 12 0 unless exists $args->{'defaults'}{'method'}
338 10 0 unless exists $args->{'defaults'}{'no_dispatcher'}
339 10 0 unless exists $args->{'defaults'}{'method'}
348 106 0 if defined $spec->{'method'}
350 51 55 if (is_ArrayRef($spec->{'signature'})) { }
351 1 50 $spec->{'named'} ? :
355 1 54 if ref $spec->{'named'}
362 350 264 if $KNOWN_OPTIONS{$key} or $key =~ /^_/
364 0 264 if ($BAD_OPTIONS{$key})
374 0 4 ref $sub_name ? :
377 98 8 if (is_Int($tp{'method'}))
378 4 94 if ($tp{'method'} > 1)
381 0 4 ref $tp{'head'} ? :
383 86 12 if ($tp{'method'} == 1)
388 4 0 unless ($tp{'named'} or $tp{'pos'} or $tp{'positional'} or $tp{'multi'} or $tp{'multiple'})
415 130 512 if ($delete_while_copying{$_}) { }
433 14 0 $first ? :
442 0 4 unless ref $spec{'alias'}
456 1 105 if ($spec{'want'})
460 0 1 $_ eq '~SCALAR' ? :
0 1 $_ eq '~LIST' ? :
0 1 if ($_ eq '~VOID') { }
466 0 1 is_ArrayRef($spec{'want'}) ? :
472 98 8 if defined $sub_name
475 16 90 if ($spec{'alias'})
478 4 12 is_ArrayRef($spec{'alias'}) ? :
481 0 16 if (is_CodeRef($spec{'signature'}))
492 0 0 defined $spec{'die'} ? :
0 0 is_CodeRef($spec{'die'}) ? :
16 0 defined $spec{'code'} ? :
505 0 16 unless eval $code
511 4 12 exists &{"${target}::$alias";} ? :
514 4 12 if ($existing)
515 2 2 $spec{'is_monomethod'} && $alias eq $aliases[0] ? :
526 72 30 if defined $sub_name and not $spec{'no_dispatcher'}
528 10 88 if (not $hooked{$target} and "Role::Hooks"->is_role($target))
532 14 6 unless "Role::Hooks"->is_role($consumerpkg)
545 14 46 if (is_ScalarRef($sub_name)) { }
46 0 elsif (is_Str($sub_name)) { }
546 4 10 if (is_Undef($$sub_name)) { }
10 0 elsif (is_CodeRef($$sub_name) or is_Object($$sub_name)) { }
553 10 0 if ($me->known_dispatcher($$sub_name)) { }
580 0 4 unless $CLEANUP{"$blessed_coderef"}
581 4 0 if ($target and $sub_name)
594 0 86 unless (exists &mro::get_linear_isa or eval {
599 38 48 exists &{"${target}::$sub_name";} ? :
603 0 86 unless defined $sub_name
605 34 52 if ($existing and $me->known_dispatcher($existing)) { }
4 48 elsif ($existing) { }
613 12 36 ref $sub_name ? :
633 0 48 unless eval $code
644 0 123 if @_ < 5
647 78 45 if ($is_method and is_Object($argv->[0])) { }
10 66 elsif ($is_method and &is_ClassName($argv->[0])) { }
661 79 8 defined $wantarray ? :
36 87 $wantarray ? :
6 117 unless (my($winner, $new_argv) = $me->pick_candidate($CACHE{"$pkg/$search_from/$method_name/$is_method"} ||= [$me->get_all_multimethod_candidates($search_from, $method_name, $is_method)], $argv, $wantarray ? "LIST" : (defined $wantarray ? "SCALAR" : "VOID")))
666 117 0 if (my $next = $winner->{'code'}) { }
0 0 elsif (defined $winner->{'die'}) { }
672 0 0 is_CodeRef($winner->{'die'}) ? :
683 4 158 if $candidate->{'smiple'}
684 6 152 unless $smiple_keys->all(keys %{$$candidate{"signature_spec"};})
686 0 0 $_ ? :
0 244 if (is_Bool($_)) { }
687 0 152 unless $candidate->{'signature_spec'}{'pos'} or $candidate->{'signature_spec'}{'positional'}
688 0 152 unless &TypeTiny()->all(@types)
689 136 16 if (&TypeTiny()->check($candidate->{'signature_spec'}{'method'})) { }
0 16 elsif ($candidate->{'signature_spec'}{'method'}) { }
695 4 148 if grep {$_->has_coercion;} @types
708 588 166 if $candidate->{'compiled'}
709 4 162 if (is_CodeRef($candidate->{'signature'})) { }
730 3 732 $_->{'if'} ? :
731 2 734 $_->{'want'} && $wantarray ? :
734 4 736 defined $_->{'compiled'}{'max_args'} && $_->{'compiled'}{'max_args'} < $argc ? :
14 740 if (defined $_->{'compiled'}{'min_args'} and $_->{'compiled'}{'min_args'} > $argc) { }
745 667 66 if (my $smiple = $_->{'smiple'}) { }
746 193 474 !ref($smiple) || &$smiple($argv) ? :
759 58 65 if (@remaining > 1)
765 74 90 unless (defined $score)
769 70 152 is_ArrayRef($candidate->{'signature_spec'}{$_}) ? :
772 0 100 unless is_Object($type)
773 4 96 if $type == $slurpyAny
777 2 72 if $candidate->{'want'} or $candidate->{'if'}
786 20 103 if (@remaining > 1)
793 10 113 if (@remaining > 1)
800 8 115 if (@remaining > 1)
808 0 123 unless wantarray
810 6 117 unless @remaining