Branch Coverage

blib/lib/Class/MOP/Class.pm
Criterion Covered Total %
branch 218 236 92.3


line true false branch
32 701440 2 if (@_ % 2) { }
39 7 701435 unless $package_name and not ref $package_name
47 116 0 if @args % 2
51 98 18 &blessed($options{'package'}) ? :
54 114 2 if not exists $options{'weaken'} and &blessed($old_metaclass) and $old_metaclass->isa("Class::MOP::Class")
56 114 2 if $old_metaclass and $old_metaclass->isa("Class::MOP::Class")
59 113 0 if $old_metaclass and $old_metaclass->isa("Class::MOP::Class")
72 0 30241 @_ == 1 ? :
74 4 30237 unless defined $package_name and $package_name
82 5 30232 if (defined(my $meta = Class::MOP::get_metaclass_by_name($package_name)))
87 3576 26656 ref $class ? :
93 27489 2743 if ($class eq 'Class::MOP::Class') { }
112 105 30120 if $options->{'weaken'}
122 11332 19968 $self->is_immutable ? :
130 0 27489 if $class ne "Class::MOP::Class"
133 27489 0 @_ == 1 ? :
197 15603 18235 unless my(@superclasses) = $self->superclasses
209 76207 15239 unless not defined $meta
211 15236 2993 if ref $self eq "Class::MOP::Class" and &all(sub {
218 35 17860 unless defined $self->$metaclass_type
230 6 3324 if (not $self->_class_metaclass_is_compatible($superclass_name))
259 10 19872 if (not $self->_single_metaclass_is_compatible($metaclass_type, $superclass_name))
278 3 20371 unless $super_meta->can($metaclass_type)
281 850 19521 unless defined $super_meta->$metaclass_type
284 19 19502 unless defined $self->$metaclass_type
295 81 23103 if $self->_can_fix_metaclass_incompatibility($super)
298 18153 81 unless $necessary
301 67 20 unless ($self->_class_metaclass_is_compatible($super->name))
309 136 356 unless ($self->_single_metaclass_is_compatible($metaclass_type, $super->name))
322 66 23119 if $self->_class_metaclass_can_be_made_compatible($super_meta)
326 15 138664 if $self->_single_metaclass_can_be_made_compatible($super_meta, $metaclass_type)
345 3 138937 unless $super_meta->can($metaclass_type)
350 20710 118227 unless defined $super_specific_meta
354 21 118206 unless defined $specific_meta
356 129 118076 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 1522 5 if @args % 2 == 1
422 1435 92 if exists $options{'superclasses'}
428 24 1502 if exists $options{'attributes'}
434 26 1499 if exists $options{'methods'}
442 2 1522 exists $options{'meta_name'} ? :
446 1518 1 if defined $meta_name
449 1434 85 if defined $superclasses
456 23 1485 if (defined $attributes)
461 25 1482 if (defined $methods)
480 0 0 unless $options{'superclasses'}
494 6 21308 if $class->name->isa("Class::MOP::Class")
501 23455 596 @_ == 1 ? :
508 9 24042 if (my $instance_class = &blessed($params->{'__INSTANCE__'})) { }
5 24037 elsif (exists $params->{'__INSTANCE__'}) { }
513 3 6 unless $instance_class eq $class->name
528 1683 21366 if (Class::MOP::metaclass_is_weak($class->name))
600 109284 4277 if (defined(my $init_arg = $attr->init_arg)) { }
3888 389 elsif (my(@default) = $self->_inline_init_attr_from_default($attr, $idx)) { }
606 34922 74362 if (my(@default) = $self->_inline_init_attr_from_default($attr, $idx))
635 0 106791 if $attr->has_initializer
650 72390 38669 unless $default
654 0 38669 if $attr->has_initializer
668 38807 73475 if ($attr->has_default) { }
3 73472 elsif ($attr->has_builder) { }
675 27429 11378 if ($attr->is_default_a_coderef) { }
692 21 12554 if (Class::MOP::metaclass_is_weak($self->name)) { }
732 4 21722 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 1165 239 if ($attr->has_value($instance))
871 913 252 if (defined(my $init_arg = $attr->init_arg)) { }
873 910 3 unless exists $params{$init_arg}
910 1 43 unless my $removed_attribute = $self->SUPER::remove_attribute(@_)
927 24711 6365 if $meta->has_attribute($attr_name)
948 3613 42964 if (@_)
1014 0 3803 unless (&Class::MOP::IS_RUNNING_ON_5_10())
1027 1 3802 if (&mro::get_mro($name) eq 'c3') { }
1086 1 158 unless defined $method_name and length $method_name
1096 1 54 unless defined $method_name and length $method_name
1106 1 15716 unless defined $method_name and length $method_name
1130 1 36129 unless defined $method_name and length $method_name
1134 17555 113652 if defined $method
1159 3 1558 unless defined $method_name and length $method_name
1165 691 4925 if $meta->has_method($method_name)
1176 1 30959 unless defined $method_name and length $method_name
1182 30132 27145 if defined $method
1190 0 3591 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 16 unless $_[0]{'__immutable'}{'options'}
1293 9 23223 unless $self->is_mutable
1310 14 2 if ($self->is_immutable) { }
1333 0 23221 if (my $class = $args{'immutable_metaclass'})
1347 23218 2 if ($meta_attr and $trait eq $meta_attr->default) { }
1357 22521 699 if Class::MOP::does_metaclass_exist($class_name)
1389 0 15 unless $_[0]{'__immutable'}{'inlined_methods'}
1408 12978 10245 if $args{'inline_accessors'}
1409 12578 10645 if $args{'inline_constructor'}
1410 780 22442 if $args{'inline_destructor'}
1434 0 12578 unless defined $name
1436 2 12576 if ($self->has_method($name) and not $args{'replace_constructor'})
1466 12568 7 if ($args{'replace_constructor'} or $constructor->can_be_inlined)
1476 1 779 unless exists $args{'destructor_class'} and defined $args{'destructor_class'}
1480 2 777 if ($self->has_method("DESTROY") and not $args{'replace_destructor'})
1494 18 759 unless $destructor_class->is_needed($self)
1508 758 1 if ($args{'replace_destructor'} or $destructor->can_be_inlined)