Branch Coverage

blib/lib/Moose/Meta/Attribute.pm
Criterion Covered Total %
branch 253 302 83.7


line true false branch
46 2 212 unless defined $name
57 2692 31 unless $options{'__hack_no_process_options'}
70 1 2698 if (@bad)
72 0 1 @bad > 1 ? :
81 1 0 if (defined $package)
83 1 0 if $type
97 2 2298 if @_ % 2 == 1
105 197 2099 scalar @traits ? :
113 10 2328 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 200 2129 if (my $traits = $options->{'traits'})
133 0 209 if ref $trait
138 0 207 if $class->does($trait)
143 2 205 if ($traits->[$i] and ref $traits->[$i])
145 1 2 if $_ ne "-alias"
0 2 if &any(sub {
151 198 0 if (@traits)
157 0 198 if ($has_foreign_options) { }
169 2327 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 506 2185 unless $options->{'is'}
286 1889 296 if ($options->{'is'} eq 'ro') { }
269 27 elsif ($options->{'is'} eq 'rw') { }
26 1 elsif ($options->{'is'} eq 'bare') { }
290 2 1887 if exists $options->{'accessor'}
294 267 2 if (not $options->{'accessor'})
295 1 266 if ($options->{'writer'}) { }
317 684 2035 unless exists $options->{'isa'}
319 5 2030 if (exists $options->{'does'})
320 3 2 if (&try(sub {
321 2 1 unless $options->{'isa'}->does($options->{'does'})
338 84 1947 if (&blessed($options->{'isa'}) and $options->{'isa'}->can('has_coercion')) { }
355 2696 18 unless exists $options->{'does'} and not exists $options->{'isa'}
358 1 17 if (&blessed($options->{'does'}) and $options->{'does'}->can('has_coercion')) { }
375 2642 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 2648 29 unless exists $options->{'trigger'}
403 3 26 unless "CODE" eq ref $options->{'trigger'}
411 2661 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 2679 24 unless $options->{'lazy_build'}
433 1 23 if exists $options->{'default'}
438 1 22 if ($name =~ /^_/) { }
451 2148 523 unless $options->{'lazy'}
454 2 521 unless exists $options->{'default'} or defined $options->{'builder'}
462 1 2668 if ($options->{'required'} and not !exists $options->{'init_arg'} || defined $options->{'init_arg'} || exists $options->{'default'} || defined $options->{'builder'})
483 1935 4255 if (defined $init_arg and exists $params->{$init_arg}) { }
489 307 3948 if $self->is_lazy
492 52 0 defined $init_arg ? :
52 9 if $self->is_required and not $self->has_default and not $self->has_builder
505 2295 1601 if ($self->has_default) { }
14 1587 elsif ($self->has_builder) { }
515 1587 4242 unless $value_is_set
521 47 3251 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 3563 if ($self->_writer_value_needs_copy)
603 1048 2557 unless $for_constructor
609 1048 2557 unless $for_constructor
618 1048 2557 unless $for_constructor
639 1035 13 unless $self->is_required
645 13 0 if defined $self->init_arg
679 4307 146 unless $self->should_coerce and $self->type_constraint->has_coercion
681 38 108 if ($self->type_constraint->can_be_inlined) { }
701 878 3575 unless $self->has_type_constraint
705 3362 213 if ($self->type_constraint->can_be_inlined) { }
741 1246 58 unless $self->has_trigger
754 3504 761 unless $self->is_weak_ref
767 1568 93 unless $self->has_trigger
777 145 4098 if $self->has_trigger
779 1167 3076 if $self->has_default
782 3204 1039 if ($self->has_type_constraint)
785 278 2926 unless $tc_obj->can_be_inlined
789 179 3025 if $tc_obj->has_coercion
792 6 3198 $tc_obj->has_message ? :
802 2 4241 if $self->has_initializer and $self->is_lazy
824 7 64 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 70 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 3417 660 unless $self->is_lazy
905 0 660 unless ($self->has_default or $self->has_builder)
910 637 23 $self->has_type_constraint ? :
927 209 467 if ($self->has_default) { }
467 0 elsif ($self->has_builder) { }
929 112 97 if $self->is_default_a_coderef
966 2 658 if ($self->has_initializer) { }
984 2951 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 2844 if $self->has_handles
1021 2 2287 unless (@{$self->associated_methods;} or ($self->_is_metadata || '') eq "bare")
1039 0 3214 if (ref $accessor || '') eq "HASH"
1042 377 2837 if ($method and $method->isa("Class::MOP::Method::Accessor"))
1056 0 377 unless ($method->associated_attribute->name eq $self->name and ($generate_as_inline_methods and not $method->is_inline))
1068 0 0 if (my $method_context = $method->definition_context)
1075 0 0 if defined $method_context->{'file'} and $method_context->{'line'}
1084 0 0 if (my $self_context = $self->definition_context)
1091 0 0 if defined $self_context->{'file'} and $self_context->{'line'}
1098 0 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 0 3214 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 252 4054 unless $self->has_type_constraint
1315 115 3939 if $self->should_coerce and $self->type_constraint->has_coercion
1327 1 4056 unless $self->has_type_constraint
1331 946 3110 unless $type_constraint->check($val)