Branch Coverage

blib/lib/MOP/Role.pm
Criterion Covered Total %
branch 167 202 82.6


line true false branch
23 16 99 if (scalar @_ == 1) { }
24 4 12 if (ref $_[0]) { }
25 4 0 if (ref $_[0] eq 'HASH')
26 2 2 if (MOP::Internal::Util::IS_STASH_REF($_[0])) { }
50 0 115 unless $args{'name'}
53 0 115 unless MOP::Internal::Util::IS_VALID_MODULE_NAME($args{'name'})
65 113 2 unless ($stash)
96 0 8 unless $version
103 0 8 unless $authority
112 109 52 unless $does
118 0 1 if scalar @roles == 0
127 0 23 unless $to_test
133 6 17 unless @roles
137 13 7 if $role eq $to_test
142 3 1 if 'MOP::Role'->new('name', $role)->does_role($to_test)
158 944 286 if (my $code = MOP::Internal::Util::GET_GLOB_SLOT($stash, $candidate, 'CODE'))
174 5 459 if $method->is_required
178 3 456 if ($method->origin_stash ne $class)
185 0 3 unless @roles
190 0 3 unless $method->was_aliased_from(@roles)
217 6 2 if not $_->is_required
254 0 39 unless $name
257 3 36 unless exists $stash->{$name}
269 0 20 unless $name
273 3 17 unless exists $stash->{$name}
274 11 6 unless MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($stash->{$name})
282 5 1 if $method->origin_stash eq $class
290 0 5 unless $name
294 3 2 if (my $glob = $self->stash->{$name})
296 1 2 if MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($glob)
302 2 0 ref \$glob eq 'GLOB' ? :
1 1 if ref \$glob eq 'GLOB' ? defined *{$glob;}{'CODE'} : defined $glob
315 0 4 unless $name
319 3 1 if (my $glob = $self->stash->{$name})
321 1 2 if (MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($glob)) { }
331 1 1 if defined *{$glob;}{'CODE'}
350 0 460 unless $name
354 425 35 unless exists $stash->{$name}
355 5 30 if MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($stash->{$name})
359 27 3 if (my $code = MOP::Internal::Util::GET_GLOB_SLOT($stash, $name, 'CODE'))
378 0 22 unless $name
382 2 20 unless exists $stash->{$name}
383 3 17 if MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($stash->{$name})
386 14 3 if (my $code = MOP::Internal::Util::GET_GLOB_SLOT($stash, $name, 'CODE'))
391 13 1 if $method->origin_stash eq $class or @roles and $method->was_aliased_from(@roles)
403 0 1 unless $name
406 0 1 unless $code and ref $code eq 'CODE'
416 0 5 unless $name
420 4 1 if (my $glob = $self->stash->{$name})
422 1 3 if (MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($glob)) { }
430 1 2 unless defined *{$glob;}{'CODE'}
440 1 1 if ($method->origin_stash ne $self->name)
447 1 0 unless (@roles and $method->was_aliased_from(@roles))
468 0 15 unless $name
472 2 13 unless exists $stash->{$name}
473 1 12 if MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($stash->{$name})
476 9 3 if (my $code = MOP::Internal::Util::GET_GLOB_SLOT($stash, $name, 'CODE'))
480 7 2 if $method->origin_stash ne $class
498 0 421 unless $name
501 0 421 unless $code and ref $code eq 'CODE'
511 0 6 unless $name
515 5 1 if (my $glob = $self->stash->{$name})
517 1 4 if (MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($glob)) { }
525 1 3 unless defined *{$glob;}{'CODE'}
531 1 2 if $method->origin_stash eq $self->name
548 0 33 unless $name
552 3 30 unless exists $stash->{$name}
553 5 25 if MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($stash->{$name})
557 21 4 if (my $code = MOP::Internal::Util::GET_GLOB_SLOT($stash, $name, 'CODE'))
577 25 24 unless $has
592 3 5 unless $_->origin_stash eq $class
613 0 13 unless $name
616 3 10 unless $has
617 4 6 unless exists $has->{$name}
635 0 18 unless $name
638 3 15 unless $has
639 4 11 unless exists $has->{$name}
647 9 2 if $slot->origin_stash eq $class or @roles and $slot->was_aliased_from(@roles)
659 0 3 unless $name
662 0 3 unless $initializer and ref $initializer eq 'CODE' || MOP::Internal::Util::CAN_COERCE_TO_CODE_REF($initializer)
672 1 2 if $slot->origin_stash ne $class
676 1 2 unless $has
689 0 4 unless $name
694 1 3 unless $has
695 1 2 unless exists $has->{$name}
700 1 1 if 'MOP::Slot'->new('name', $name, 'initializer', $has->{$name})->origin_stash ne $class
714 0 9 unless $name
717 1 8 unless $has
718 2 6 unless exists $has->{$name}
732 0 9 unless $name
735 1 8 unless $has
736 1 7 unless exists $has->{$name}
743 5 2 if $slot->origin_stash ne $class
754 0 3 unless $name
757 0 3 unless $initializer and ref $initializer eq 'CODE' || MOP::Internal::Util::CAN_COERCE_TO_CODE_REF($initializer)
764 1 2 if $slot->origin_stash eq $class
768 1 1 unless $has
781 0 4 unless $name
786 1 3 unless $has
787 1 2 unless exists $has->{$name}
792 1 1 if 'MOP::Slot'->new('name', $name, 'initializer', $has->{$name})->origin_stash eq $class