Branch Coverage

blib/lib/Moose/Meta/Attribute.pm
Criterion Covered Total %
branch 262 302 86.7


line true false branch
46 2 215 unless defined $name
57 2725 31 unless $options{'__hack_no_process_options'}
70 1 2731 if (@bad)
72 0 1 @bad > 1 ? :
81 1 0 if (defined $package)
83 1 0 if $type
97 2 2320 if @_ % 2 == 1
105 200 2118 scalar @traits ? :
113 10 2350 if (my $metaclass_name = delete $options->{'metaclass'})
116 10 0 if ($class ne $new_class)
117 9 1 if ($new_class->can('interpolate_class')) { }
127 203 2148 if (my $traits = $options->{'traits'})
133 0 212 if ref $trait
138 0 210 if $class->does($trait)
143 5 205 if ($traits->[$i] and ref $traits->[$i])
145 3 3 if $_ ne "-alias"
1 4 if &any(sub {
151 201 0 if (@traits)
157 1 200 if ($has_foreign_options) { }
169 2349 0 wantarray ? :
203 37 0 $self->can('illegal_options_for_inheritance') ? :
207 8 180 exists $options{$_} && exists $self->{$_} ? :
208 6 31 unless scalar @found_illegal_options == 0
220 31 0 if ($self->can("interpolate_class"))
224 29 2 unless $self->applied_traits
225 0 31 if @all_traits
230 31 0 if $self->can("_process_lazy_build_option")
244 309 0 $attr->has_init_arg ? :
277 522 2202 unless $options->{'is'}
286 1901 301 if ($options->{'is'} eq 'ro') { }
274 27 elsif ($options->{'is'} eq 'rw') { }
26 1 elsif ($options->{'is'} eq 'bare') { }
290 2 1899 if exists $options->{'accessor'}
294 271 3 if (not $options->{'accessor'})
295 1 270 if ($options->{'writer'}) { }
317 710 2042 unless exists $options->{'isa'}
319 5 2037 if (exists $options->{'does'})
320 3 2 if (&try(sub {
321 2 1 unless $options->{'isa'}->does($options->{'does'})
338 84 1954 if (&blessed($options->{'isa'}) and $options->{'isa'}->can('has_coercion')) { }
355 2729 18 unless exists $options->{'does'} and not exists $options->{'isa'}
358 1 17 if (&blessed($options->{'does'}) and $options->{'does'}->can('has_coercion')) { }
375 2675 41 unless $options->{'coerce'}
378 1 40 unless exists $options->{'type_constraint'}
385 1 39 if $options->{'weak_ref'}
387 4 35 unless ($options->{'type_constraint'}->has_coercion)
400 2681 29 unless exists $options->{'trigger'}
403 3 26 unless "CODE" eq ref $options->{'trigger'}
411 2694 13 unless $options->{'auto_deref'}
414 1 12 unless exists $options->{'type_constraint'}
419 1 11 unless $options->{'type_constraint'}->is_a_type_of("ArrayRef") or $options->{'type_constraint'}->is_a_type_of("HashRef")
428 2712 24 unless $options->{'lazy_build'}
433 1 23 if exists $options->{'default'}
438 1 22 if ($name =~ /^_/) { }
451 2179 525 unless $options->{'lazy'}
454 2 523 unless exists $options->{'default'} or defined $options->{'builder'}
462 1 2701 if ($options->{'required'} and not !exists $options->{'init_arg'} || defined $options->{'init_arg'} || exists $options->{'default'} || defined $options->{'builder'})
483 1932 4238 if (defined $init_arg and exists $params->{$init_arg}) { }
489 306 3932 if $self->is_lazy
492 52 0 defined $init_arg ? :
52 10 if $self->is_required and not $self->has_default and not $self->has_builder
505 2289 1591 if ($self->has_default) { }
14 1577 elsif ($self->has_builder) { }
515 1577 4233 unless $value_is_set
521 47 3242 if (ref $val and $self->is_weak_ref)
531 12 2 if $instance->can($self->builder)
555 1 52 if ($self->is_required and not @args)
556 1 0 defined $self->init_arg ? :
571 1 51 if ($self->has_trigger and $self->has_value($instance))
577 0 52 if (ref $value and $self->is_weak_ref)
581 2 50 if ($self->has_trigger)
597 42 3606 if ($self->_writer_value_needs_copy)
603 1078 2570 unless $for_constructor
609 1078 2570 unless $for_constructor
618 1078 2570 unless $for_constructor
639 1065 13 unless $self->is_required
645 13 0 if defined $self->init_arg
679 4352 146 unless $self->should_coerce and $self->type_constraint->has_coercion
681 38 108 if ($self->type_constraint->can_be_inlined) { }
701 908 3590 unless $self->has_type_constraint
705 3377 213 if ($self->type_constraint->can_be_inlined) { }
741 1276 58 unless $self->has_trigger
754 3527 783 unless $self->is_weak_ref
767 1598 93 unless $self->has_trigger
777 145 4145 if $self->has_trigger
779 1167 3123 if $self->has_default
782 3211 1079 if ($self->has_type_constraint)
785 278 2933 unless $tc_obj->can_be_inlined
789 179 3032 if $tc_obj->has_coercion
792 6 3205 $tc_obj->has_message ? :
802 2 4288 if $self->has_initializer and $self->is_lazy
824 7 62 if ($self->is_lazy)
825 3 4 unless ($self->has_value($instance))
827 3 0 if ($self->has_default) { }
0 0 elsif ($self->has_builder) { }
837 1 2 if (ref $value and $self->is_weak_ref)
843 1 68 if ($self->should_auto_deref and not $for_trigger) { }
847 0 1 if ($type_constraint->is_a_type_of('ArrayRef')) { }
0 1 elsif ($type_constraint->is_a_type_of('HashRef')) { }
849 0 0 unless defined $rv
850 0 0 wantarray ? :
854 0 0 unless defined $rv
855 0 0 wantarray ? :
890 3456 662 unless $self->is_lazy
905 0 662 unless ($self->has_default or $self->has_builder)
910 639 23 $self->has_type_constraint ? :
927 209 469 if ($self->has_default) { }
469 0 elsif ($self->has_builder) { }
929 112 97 if $self->is_default_a_coderef
966 2 660 if ($self->has_initializer) { }
984 2992 10 unless $self->should_auto_deref
989 7 3 if ($type_constraint->is_a_type_of('ArrayRef')) { }
3 0 elsif ($type_constraint->is_a_type_of('HashRef')) { }
1015 230 2888 if $self->has_handles
1021 2 2309 unless (@{$self->associated_methods;} or ($self->_is_metadata || '') eq "bare")
1039 0 3261 if (ref $accessor || '') eq "HASH"
1042 390 2871 if ($method and $method->isa("Class::MOP::Method::Accessor"))
1056 2 388 unless ($method->associated_attribute->name eq $self->name and ($generate_as_inline_methods and not $method->is_inline))
1068 2 0 if (my $method_context = $method->definition_context)
1075 2 0 if defined $method_context->{'file'} and $method_context->{'line'}
1084 2 0 if (my $self_context = $self->definition_context)
1091 2 0 if defined $self_context->{'file'} and $self_context->{'line'}
1098 5 2 if ($method and not $method->is_stub and not $method->isa("Class::MOP::Method::Accessor") and !$self->definition_context || $method->package_name eq $self->definition_context->{'package'})
1111 1 3260 if (not $self->associated_class->has_method($accessor) and $self->associated_class->has_package_symbol("&" . $accessor))
1125 24 30 if $self->has_handles
1147 6 1113 if (my $method = $associated_class->get_method($handle))
1148 4 2 unless $method->is_stub
1163 33 1079 if $class_name->isa("Moose::Object") and $handle =~ /^BUILD|DEMOLISH$/ || 'Moose::Object'->can($handle)
1180 17 5 unless &any(sub {
1190 68 5 if (my $handle_type = ref $handles)
1191 7 61 if ($handle_type eq 'HASH') { }
20 41 elsif ($handle_type eq 'ARRAY') { }
29 12 elsif ($handle_type eq 'Regexp') { }
8 4 elsif ($handle_type eq 'CODE') { }
1 3 elsif (&blessed($handles) and $handles->isa('Moose::Meta::TypeConstraint::DuckType')) { }
1 2 elsif (&blessed($handles) and $handles->isa('Moose::Meta::TypeConstraint::Role')) { }
1198 6 23 unless $self->has_type_constraint
1222 2 4 unless &blessed($role_meta) and $role_meta->isa("Moose::Meta::Role")
1238 7 2 if ($meta->isa('Class::MOP::Class')) { }
0 2 elsif ($meta->isa('Moose::Meta::Role')) { }
1240 48 40 if $_->package_name ne "Moose::Object"
1258 23 8 if ($class) { }
4 4 elsif ($role) { }
1260 4 19 unless ($self->type_constraint->isa("Moose::Meta::TypeConstraint::Class"))
1265 4 15 unless (Moose::Util::_is_package_loaded($class))
1276 4 0 unless (Moose::Util::_is_package_loaded($role))
1296 2 48 if "ARRAY" eq ref $method_to_call
1313 254 4043 unless $self->has_type_constraint
1315 115 3928 if $self->should_coerce and $self->type_constraint->has_coercion
1327 1 4045 unless $self->has_type_constraint
1331 946 3099 unless $type_constraint->check($val)