Branch Coverage

blib/lib/MOP/Role.pm
Criterion Covered Total %
branch 166 200 83.0


line true false branch
25 16 94 if (scalar @_ == 1) { }
26 4 12 if (ref $_[0]) { }
27 4 0 if (ref $_[0] eq 'HASH')
28 2 2 if (MOP::Internal::Util::IS_STASH_REF($_[0])) { }
52 0 110 unless $args{'name'}
55 0 110 unless MOP::Internal::Util::IS_VALID_MODULE_NAME($args{'name'})
67 108 2 unless ($stash)
98 0 8 unless $version
105 0 8 unless $authority
114 103 52 unless $does
120 0 1 if scalar @roles == 0
129 0 23 unless $to_test
135 6 17 unless @roles
139 13 7 if $role eq $to_test
144 3 1 if 'MOP::Role'->new('name', $role)->does_role($to_test)
160 941 274 if (my $code = MOP::Internal::Util::GET_GLOB_SLOT($stash, $candidate, 'CODE'))
176 5 459 if $method->is_required
180 3 456 if ($method->origin_stash ne $class)
187 0 3 unless @roles
192 0 3 unless $method->was_aliased_from(@roles)
219 3 2 if not $_->is_required
256 0 37 unless $name
259 3 34 unless exists $stash->{$name}
271 0 20 unless $name
275 3 17 unless exists $stash->{$name}
276 11 6 unless MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($stash->{$name})
284 5 1 if $method->origin_stash eq $class
292 0 5 unless $name
296 3 2 if (my $glob = $self->stash->{$name})
298 1 2 if MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($glob)
302 1 1 if defined *{$glob;}{'CODE'}
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 14 unless $name
472 2 12 unless exists $stash->{$name}
473 1 11 if MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($stash->{$name})
476 8 3 if (my $code = MOP::Internal::Util::GET_GLOB_SLOT($stash, $name, 'CODE'))
480 6 2 if $method->origin_stash ne $class
498 0 420 unless $name
501 0 420 unless $code and ref $code eq 'CODE'
511 0 5 unless $name
515 4 1 if (my $glob = $self->stash->{$name})
517 1 3 if (MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($glob)) { }
525 1 2 unless defined *{$glob;}{'CODE'}
531 1 1 if $method->origin_stash eq $self->name
548 0 30 unless $name
552 2 28 unless exists $stash->{$name}
553 5 23 if MOP::Internal::Util::DOES_GLOB_HAVE_NULL_CV($stash->{$name})
557 20 3 if (my $code = MOP::Internal::Util::GET_GLOB_SLOT($stash, $name, 'CODE'))
577 25 18 unless $has
592 2 4 unless $_->origin_stash eq $class
613 0 11 unless $name
616 3 8 unless $has
617 4 4 unless exists $has->{$name}
635 0 16 unless $name
638 3 13 unless $has
639 4 9 unless exists $has->{$name}
647 8 1 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 8 unless $name
717 1 7 unless $has
718 2 5 unless exists $has->{$name}
732 0 8 unless $name
735 1 7 unless $has
736 1 6 unless exists $has->{$name}
743 4 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