Branch Coverage

blib/lib/Class/MOP/Class.pm
Criterion Covered Total %
branch 217 236 91.9


line true false branch
32 684221 2 if (@_ % 2) { }
39 7 684216 unless $package_name and not ref $package_name
47 115 0 if @args % 2
51 97 18 &blessed($options{'package'}) ? :
54 113 2 if not exists $options{'weaken'} and &blessed($old_metaclass) and $old_metaclass->isa("Class::MOP::Class")
56 113 2 if $old_metaclass and $old_metaclass->isa("Class::MOP::Class")
59 112 0 if $old_metaclass and $old_metaclass->isa("Class::MOP::Class")
72 0 29423 @_ == 1 ? :
74 4 29419 unless defined $package_name and $package_name
82 5 29414 if (defined(my $meta = Class::MOP::get_metaclass_by_name($package_name)))
87 3477 25937 ref $class ? :
93 26732 2682 if ($class eq 'Class::MOP::Class') { }
112 105 29302 if $options->{'weaken'}
122 11062 19453 $self->is_immutable ? :
130 0 26732 if $class ne "Class::MOP::Class"
133 26732 0 @_ == 1 ? :
197 15177 17756 unless my(@superclasses) = $self->superclasses
209 74144 14825 unless not defined $meta
211 14821 2929 if ref $self eq "Class::MOP::Class" and &all(sub {
218 30 17476 unless defined $self->$metaclass_type
230 6 3260 if (not $self->_class_metaclass_is_compatible($superclass_name))
259 10 19488 if (not $self->_single_metaclass_is_compatible($metaclass_type, $superclass_name))
278 3 19980 unless $super_meta->can($metaclass_type)
281 841 19139 unless defined $super_meta->$metaclass_type
284 19 19120 unless defined $self->$metaclass_type
295 81 22499 if $self->_can_fix_metaclass_incompatibility($super)
298 17674 81 unless $necessary
301 67 20 unless ($self->_class_metaclass_is_compatible($super->name))
309 136 349 unless ($self->_single_metaclass_is_compatible($metaclass_type, $super->name))
322 66 22515 if $self->_class_metaclass_can_be_made_compatible($super_meta)
326 15 135041 if $self->_single_metaclass_can_be_made_compatible($super_meta, $metaclass_type)
345 3 135314 unless $super_meta->can($metaclass_type)
350 20164 115150 unless defined $super_specific_meta
354 21 115129 unless defined $specific_meta
356 129 114999 if $specific_meta->_can_be_made_compatible_with($super_specific_meta)
363 66 1 if ($self->_class_metaclass_can_be_made_compatible($super_meta))
364 3 63 unless $self->is_pristine
379 135 1 if ($self->_single_metaclass_can_be_made_compatible($super_meta, $metaclass_type))
380 2 133 unless $self->is_pristine
386 114 19 $self->$metaclass_type ? :
415 1499 5 if @args % 2 == 1
422 1412 92 if exists $options{'superclasses'}
428 24 1479 if exists $options{'attributes'}
434 26 1476 if exists $options{'methods'}
442 2 1499 exists $options{'meta_name'} ? :
446 1495 1 if defined $meta_name
449 1411 85 if defined $superclasses
456 23 1462 if (defined $attributes)
461 25 1459 if (defined $methods)
480 0 0 unless $options{'superclasses'}
494 6 20905 if $class->name->isa("Class::MOP::Class")
501 23002 585 @_ == 1 ? :
508 9 23578 if (my $instance_class = &blessed($params->{'__INSTANCE__'})) { }
5 23573 elsif (exists $params->{'__INSTANCE__'}) { }
513 3 6 unless $instance_class eq $class->name
528 1683 20902 if (Class::MOP::metaclass_is_weak($class->name))
600 106279 4156 if (defined(my $init_arg = $attr->init_arg)) { }
3778 378 elsif (my(@default) = $self->_inline_init_attr_from_default($attr, $idx)) { }
606 33943 72336 if (my(@default) = $self->_inline_init_attr_from_default($attr, $idx))
635 0 103799 if $attr->has_initializer
650 70366 37580 unless $default
654 0 37580 if $attr->has_initializer
668 37718 71446 if ($attr->has_default) { }
3 71443 elsif ($attr->has_builder) { }
675 26659 11059 if ($attr->is_default_a_coderef) { }
692 21 12196 if (Class::MOP::metaclass_is_weak($self->name)) { }
732 4 21135 if $instance->is_dependent_on_superclasses
766 5 22 unless &blessed($instance) and $instance->isa($class->name)
774 5 17 if $instance->isa("Class::MOP::Class")
780 1 17 unless &blessed($instance)
788 163 9 if (defined(my $init_arg = $attr->init_arg))
789 15 148 if (exists $params{$init_arg})
801 126 0 if $old_metaclass
806 1 125 if (Class::MOP::metaclass_is_weak($old_metaclass->name))
817 4 118 if (Class::MOP::metaclass_is_weak($self->name))
826 45 0 $old_metaclass ? :
827 3 42 unless $self->name->isa($old_class)
842 9 0 $old_metaclass ? :
844 3 6 unless $old_class->isa($self->name)
865 1334 3 if $self->find_attribute_by_name($attr->name)
870 1167 237 if ($attr->has_value($instance))
871 915 252 if (defined(my $init_arg = $attr->init_arg)) { }
873 912 3 unless exists $params{$init_arg}
910 1 43 unless my $removed_attribute = $self->SUPER::remove_attribute(@_)
927 24073 6365 if $meta->has_attribute($attr_name)
948 3526 41892 if (@_)
1014 0 3770 unless (&Class::MOP::IS_RUNNING_ON_5_10())
1027 1 3769 if (&mro::get_mro($name) eq 'c3') { }
1086 1 152 unless defined $method_name and length $method_name
1096 1 50 unless defined $method_name and length $method_name
1106 1 15331 unless defined $method_name and length $method_name
1130 1 35186 unless defined $method_name and length $method_name
1134 17107 110693 if defined $method
1159 3 1523 unless defined $method_name and length $method_name
1165 682 4812 if $meta->has_method($method_name)
1176 1 30184 unless defined $method_name and length $method_name
1182 29385 26448 if defined $method
1190 0 3504 if ($self->{'meta_instance_dependencies'})
1216 1 3 if (my $classes = delete $self->{'meta_instance_dependencies'})
1256 6 198 if $self->get_attribute_list
1260 0 119 if $method->isa("Class::MOP::Method::Generated")
1272 1 15 unless $_[0]{'__immutable'}{'options'}
1293 8 22585 unless $self->is_mutable
1310 13 2 if ($self->is_immutable) { }
1333 0 22583 if (my $class = $args{'immutable_metaclass'})
1347 22580 2 if ($meta_attr and $trait eq $meta_attr->default) { }
1357 21901 681 if Class::MOP::does_metaclass_exist($class_name)
1389 0 14 unless $_[0]{'__immutable'}{'inlined_methods'}
1408 12603 9982 if $args{'inline_accessors'}
1409 12219 10366 if $args{'inline_constructor'}
1410 760 21824 if $args{'inline_destructor'}
1434 0 12219 unless defined $name
1436 1 12218 if ($self->has_method($name) and not $args{'replace_constructor'})
1466 12215 2 if ($args{'replace_constructor'} or $constructor->can_be_inlined)
1476 1 759 unless exists $args{'destructor_class'} and defined $args{'destructor_class'}
1480 1 758 if ($self->has_method("DESTROY") and not $args{'replace_destructor'})
1494 16 742 unless $destructor_class->is_needed($self)
1508 742 0 if ($args{'replace_destructor'} or $destructor->can_be_inlined)