Branch Coverage

blib/lib/Class/Generate.pm
Criterion Covered Total %
branch 636 890 71.4


line true false branch
79 6 47 if (defined $params{'-parent'})
86 0 47 if scalar keys %params != 1
90 0 47 if not $allow_redefine_for_class and &$class_defined($class_name)
101 15 0 if (defined($p_spec = $params{'-parent'})) { }
110 0 15 if $@ or scalar $parent->values == 0
113 0 15 if scalar keys %params != 1
118 0 15 if not $allow_redefine_for_class and &$class_defined($class_name)
121 2 13 UNIVERSAL::isa($params{$class_name}, 'ARRAY') ? :
127 0 15 unless defined $c
132 0 15 unless UNIVERSAL::isa($params{$class_name}, $class_to_ref_map{ref $c})
133 0 15 if warnings::enabled() and eval '! exists $' . $p . '::{_cginfo}'
149 0 0 unless eval '%' . $class . '::'
150 0 0 unless (eval '%' . $class . '::_cginfo')
158 0 0 if (eval '%' . $code_checking_package)
600 15 8 if defined $self->{'mem_h'}
4 8 if defined $self->{'mem_a'}
5 0 if exists $self->{'mem_h'}
4 22 if exists $self->{'mem_h'} ^ exists $o->{'mem_h'}
4 21 unless $#self_keys == scalar(keys %{$$o{'mem_h'};}) - 1
13 13 unless exists $o->{'mem_h'}{$k}
10 0 if ($self_value_defined = defined $self->{'mem_h'}{$k}) ^ defined $o->{'mem_h'}{$k}
3 8 unless $self->{'mem_h'}{$k} eq $o->{'mem_h'}{$k}
4 0 if ($self_value_defined)
0 0 if (exists $self->{'mem_h'})
0 0 if exists $self->{'mem_a'} ^ exists $o->{'mem_a'}
0 0 unless ($ub = $#{$$self{'mem_a'};}) == $#{$$o{'mem_a'};}
0 0 unless $self->{'mem_a'}[$i] eq $o->{'mem_a'}[$i]
0 0 if (exists $self->{'mem_a'})
0 7 if exists $self->{'mem'} ^ exists $o->{'mem'}
1 6 unless $self->{'mem'} eq $o->{'mem'}
3 8 if (exists $self->{'mem'})
6 13 if defined $self->[1] ^ defined $o->[1]
0 11 unless $self->[1] eq $o->[1]
8 6 if (defined $self->[1])
8 6 if exists $self->{'mem'} ^ exists $o->{'mem'}
1 12 unless $self->{'mem'} eq $o->{'mem'}
1 12 if (exists $self->{'mem'})
5 16 if defined $self->[1] ^ defined $o->[1]
5 5 unless $self->[1] eq $o->[1]
1 4 if (defined $self->[1])
4 2 exists $self->{'mem_a'} ? :
10 4 if ($#_ == -1)
5 5 if ($#_ == 0)
6 2 if ($#_ == -1)
1 2 if ($#_ == 0)
3 3 if ($#_ == -1)
0 4 if ($#_ == 0)
0 3 if ($#_ == -1)
1 4 if ($#_ == 0)
0 5 exists $self->{'mem_a'} ? :
2 3 if ($#_ == -1)
3 2 exists $self->{'mem_a'} ? :
1 4 if ($#_ == 0)
0 2 if ($#_ == 1)
1 2 exists $self->{'mem_a'} ? :
0 3 exists $self->{'mem_h'} ? :
0 4 if ($#_ == -1)
2 3 exists $self->{'mem_h'} ? :
3 2 if ($#_ == 0)
1 1 if ($#_ == 1)
0 0 exists $self->{'mem_h'} ? :
0 0 exists $self->{'mem_h'} ? :
1 37 unless ref $proto
4 32 if $#_ % 2 == 0
1 21 if @unknown_params
3 17 if exists $params{'mem'}
3 43 if $#_ % 2 == 0
1 55 if @unknown_params
21 17 if exists $params{'mem'}
9 49 if $#_ % 2 == 0
5 46 if @unknown_params
14 38 if exists $params{'mem'}
6 68 if $#_ % 2 == 0
33 39 if @unknown_params
7 33 unless not exists $params{'mem_h'} or UNIVERSAL::isa($params{'mem_h'}, 'HASH')
2 13 unless not exists $params{'mem_a'} or UNIVERSAL::isa($params{'mem_a'}, 'ARRAY')
11 8 if exists $params{'mem_h'}
9 10 if exists $params{'mem_a'}
5 19 if $#_ % 2 == 0
4 18 if @unknown_params
2 15 if exists $params{'mem'}
3 4 if defined $self->[2]
2 11 if defined $self->[1]
7 1 if defined $self->[3]
5 2 if defined $self->[2]
0 2 if defined $self->[2]
6 3 if defined $self->[1]
3 0 if defined $self->[1]
4 2 if defined $self->[1]
4 3 if defined $self->[2]
0 0 if defined $self->[3] ^ defined $o->[3]
0 1 unless ($ub = $#{$$self[3];}) == $#{$$o[3];}
0 1 unless $self->[3][$i] eq $o->[3][$i]
1 0 if (defined $self->[3])
0 0 if defined $self->[2] ^ defined $o->[2]
2 1 unless $self->[2] eq $o->[2]
3 5 if (defined $self->[2])
2 0 if defined $self->[1] ^ defined $o->[1]
2 2 unless $#self_keys == scalar(keys %{$$o[1];}) - 1
0 2 unless exists $o->[1]{$k}
4 1 if ($self_value_defined = defined $self->[1]{$k}) ^ defined $o->[1]{$k}
0 1 unless $self->[1]{$k} eq $o->[1]{$k}
1 0 if ($self_value_defined)
1 0 if (defined $self->[1])
1 1 defined $self->[3] ? :
0 0 defined $self->[3] ? :
2 2 defined $self->[3] ? :
4 5 defined $self->[3] ? :
2 0 defined $self->[3] ? :
2 3 defined $self->[1] ? :
0 3 if ($#_ == -1)
5 0 if ($#_ == 0)
0 0 if ($#_ == -1)
0 0 if ($#_ == 0)
0 2 if ($#_ == -1)
0 0 if ($#_ == 0)
0 0 if ($#_ == -1)
0 0 if ($#_ == 0)
0 2 if ($#_ == -1)
2 0 if ($#_ == 0)
0 1 if ($#_ == -1)
1 10 if ($#_ == 0)
7 0 defined $self->[3] ? :
7 2 if ($#_ == -1)
0 2 defined $self->[3] ? :
9 1 unless ref $_[0]
0 1 unless UNIVERSAL::isa($_[0], 'ARRAY')
1 0 if ($#_ == 0)
4 0 if ($#_ == 1)
0 0 defined $self->[3] ? :
4 0 if ($#_ == -1)
0 0 defined $self->[3] ? :
1 0 unless ref $_[0]
0 0 unless UNIVERSAL::isa($_[0], 'ARRAY')
4 2 if ($#_ == 0)
2 0 if ($#_ == 1)
2 1 defined $self->[1] ? :
0 1 if ($#_ == -1)
1 0 defined $self->[1] ? :
0 0 unless ref $_[0]
0 0 unless UNIVERSAL::isa($_[0], 'ARRAY')
0 0 if ($#_ == 0)
0 0 if ($#_ == 1)
0 0 defined $self->[3] ? :
0 0 if ($#_ == -1)
771 33 11 if exists $classes{$class_name}
773 2 3 unless eval '%' . $class_name . '::'
776 1 1 unless (eval 'exists $' . $class_name . '::{_cginfo}')
778 3 4 unless defined $default_type
779 1 6 if ($default_type eq 'ARRAY') { }
794 1 7 if ($info{'base'} eq 'ARRAY') { }
803 0 0 if (exists $info{'members'})
812 3 6 if ($mem_info{'type'} eq '$')
817 0 4 if ($mem_info{'type'} eq '@')
822 0 4 if ($mem_info{'type'} eq '%')
827 1 4 if exists $mem_info{'base'}
831 0 0 if (exists $info{'class_methods'})
839 0 2 if (exists $info{'instance_methods'})
847 0 2 if (exists $info{'protected'})
854 0 2 if (exists $info{'private'})
861 0 2 if exists $info{'emr'}
866 1 2 if (exists $info{'kv_style'})
872 0 3 if (exists $info{'pos_style'})
878 1 2 if (exists $info{'mix_style'})
889 1 8 if (exists $info{'own_style'})
909 19 50 if ($class->isa('Class::Generate::Array_Class')) { }
918 53 17 if (my(@members) = $class->members_values)
926 2 34 if ($m->isa('Class::Generate::Class_Method')) { }
947 10 62 if (my $emr = $class->excluded_methods_regexp)
952 61 1 if (my $constructor = $class->constructor)
958 41 28 if ($style->isa('Class::Generate::Key_Value'))
960 33 16 if (@kpn) { }
972 10 12 if ($style->isa('Class::Generate::Positional'))
975 9 6 if (@members) { }
987 5 6 if ($style->isa('Class::Generate::Mix'))
992 5 2 if (@keyed_members or @pos_members) { }
1009 5 1 if ($style->isa('Class::Generate::Own'))
1011 5 3 if (@super_values) { }
1037 31 30 $member->isa('Class::Generate::Array_Member') ? :
72 61 $member->isa('Class::Generate::Scalar_Member') ? :
1043 16 117 if (defined($base = $member->base))
1053 1 75 unless @list
1059 71 221 $#_ > 0 ? :
1090 2 59 if (not @names) { }
1102 2 59 if (not @names) { }
1115 47 14 if (not @names) { }
1127 2 59 if ($class->class_methods) { }
1137 1 1 if (not @names) { }
1153 0 61 if (my(@private_class_methods) = grep(($_->isa('Class::Generate::Class_Method') && $class->private($_->name)), $class->user_defined_methods)) { }
1175 45 2 if defined $member_regexp
1177 44 2 if defined $accessor_regexp
1179 34 12 if defined $user_defined_methods_regexp
1181 0 46 if defined $private_class_methods_regexp
1192 0 91 if $match =~ /\A(?:my|local)\b[^=;()]+$member_reference$/s
1196 1 91 unless defined($index = &member_index($class, $name))
1200 71 22 $type eq '$' ? :
1209 3 31 unless ($c->protected($element_name) or $c->private($element_name))
1212 0 5 substr($match, -1) eq '(' ? :
1216 27 7 if ($c->private($element_name) or $c->name eq $class->name)
1218 8 19 if substr($match, -1) eq '('
1226 3 3 substr($match, -1) eq '(' ? :
1234 0 2 if (defined $nonpublic_member_regexp and @objs = $method->objects)
1244 3 2 if (defined $private_class_methods_regexp)
1256 0 0 if (defined $paren_matter) { }
1258 0 0 if (index($paren_matter, ')') != -1) { }
1277 91 12 if defined $class->members($member_name)
1281 12 0 if defined $index
1290 15 61 if ($disallow_private_members) { }
1309 15 61 if ($disallow_private_members) { }
1328 4 165 if $class->private($member_name = $member->name) and $disallow_private_members
1349 15 62 $disallow_private_methods ? :
1363 34 6 if defined $class->members($element_name) || defined $class->user_defined_methods($element_name) and not $disallow_private_members && $class->private($element_name)
1370 7 0 if defined $c
1398 133 165 $seen{$_->name} ? :
1410 1 194 if (defined($code = $member->pre))
1422 15 181 if (defined($code = $member->post))
1425 0 13 if (defined $pre and not $problems_in_pre)
1436 6 189 if (defined($code = $member->assert))
1448 5 26 if ($method->isa('Class::Generate::Class_Method')) { }
1468 62 0 if $class->strict
1470 62 0 if ($class->check_params)
1476 16 46 if $class->parents
1490 1 46 if $@
1505 4 42 if ($#$class_vars >= 0)
1507 0 4 ref $_ ? :
1511 42 4 if ($valid_vars and $#$valid_vars >= 0)
1528 61 3 if (not ref $_[0]) { }
3 0 elsif (UNIVERSAL::isa($_[0], 'ARRAY')) { }
1561 104 58 if (not ref $value) { }
1567 0 58 unless UNIVERSAL::isa($value, 'HASH')
1569 1 57 unless exists $value->{$key}
1586 15 0 ref $parent ? :
1588 15 0 if (exists $stab{$method} and do { local *method_entry = $stab{$method}; defined &method_entry })
1606 0 1 if ($type =~ /^\w/) { }
1614 1 0 if $type eq '$'
1617 0 0 ref $value ? :
1618 0 0 if not UNIVERSAL::isa($result, $map{$type})
1627 1 0 if substr($comment, -1, 1) ne "\n"
1635 1 7 $#vars == 0 ? :
1660 228 1 if $#_ == -1
1667 880 0 if $#_ == -1
1674 553 3 if $#_ == -1
1681 493 4 if $#_ == -1
1688 420 0 if $#_ == -1
1695 0 4 unless ($code =~ /[;\}]\s*\Z/s)
1711 131 3 if $#_ == -1
1718 96 2 if $#_ == -1
1727 0 7 unless defined $assertion
1744 31 53 if ($class->required($name) and not $self->default)
1745 6 25 if $self->can_be_invalid
1750 53 0 if ($self->can_be_invalid)
1765 31 53 if ($class->required($name) and not $self->default) { }
53 0 elsif ($self->can_be_invalid) { }
1768 6 25 if $self->can_be_invalid
1790 61 71 if $self->can('lvalue')
1791 61 71 if $self->can('values')
1794 0 132 if defined $self->comment
1797 132 0 if ($class->include_method($member_name))
1805 132 0 if $class->check_params
1812 90 178 unless $a =~ s/^([a-z]+)_$member_name$/$1_form/
1852 106 0 if ($class->check_params) { }
1868 220 95 !($class->readonly($name) || $class->required($name)) ? :
1913 0 118 if (defined $default) { }
31 87 elsif ($class->check_params and $class->required($name)) { }
1947 24 47 $class->readonly($self->name) ? :
1956 0 71 if ($class->readonly($self->name) and not $class->check_params)
1968 0 47 if defined $self->pre
1970 6 41 if $class->check_params and defined $self->base
1973 4 43 if defined $self->post
1975 2 45 if defined $class->check_params and defined $self->assert
2004 99 0 $class->include_method($self->name) ? :
2026 37 0 unless ($self->nocopy)
2028 6 31 if $self->base
2042 5 65 if ($self->base) { }
2063 2 59 $class->readonly($self->name) ? :
2083 59 2 if ($class->accept_refs) { }
2087 2 57 if ($class->check_params and $class->readonly($self->name)) { }
2096 0 57 if defined $self->pre
2099 57 0 if $class->check_params
2105 0 57 if defined $self->post
2108 0 57 if defined $class->check_params and defined $self->assert
2127 0 59 if defined $self->pre
2129 10 49 if $class->check_params and defined $self->base
2132 0 59 if defined $self->post
2145 20 90 if (defined $base)
2232 5 25 if $class->check_params and defined $self->base
2234 0 30 if defined $self->pre
2237 0 30 if defined $self->post
2239 0 30 if defined $class->check_params and defined $self->assert
2254 34 0 $class->include_method($self->name) ? :
2267 70 2 unless $class->readonly($name)
2274 15 24 if (defined $self->base) { }
2289 29 1 if (not $self->nocopy) { }
2292 5 24 if $self->base
2314 3 24 if ($self->base) { }
2392 32 0 $class->include_method($self->name) ? :
2405 66 2 unless $class->readonly($name)
2412 10 23 if (defined $self->base) { }
2426 28 1 if (not $self->nocopy) { }
2428 5 23 if ($self->base) { }
2470 3 22 if ($self->base) { }
2498 297 61 if $#_ == -1
2505 1 51 exists $self->{'constraints'} ? :
52 0 if $#_ == -1
2508 0 0 exists $self->{'constraints'} ? :
0 0 if $#_ == 0
2523 0 0 exists $self->{'constraints'} ? :
2544 45 12 if (not $class->parents and $style->can('params_check_form'))
2548 52 5 unless ($style->isa('Class::Generate::Own'))
2552 84 34 $_->param_must_be_checked($class) ? :
2573 2 55 if defined $class->check_params and defined $self->assert
2589 1 56 $class->nfi ? :
2597 1 56 if ($class->check_params and $class->virtual)
2606 42 15 if not $class->can_assign_all_params and $style->can('init_form')
2609 57 0 if $class->check_params
2610 11 46 if (defined $class->parents) { }
2624 57 0 unless ($class->can_assign_all_params)
2626 17 40 if $class->can('size_establishment')
2628 52 5 unless ($style->isa('Class::Generate::Own'))
2650 9 48 if defined $self->post
2652 57 0 if $class->check_params
2683 26 0 if $#_ == -1
2692 0 26 if defined $self->comment
2708 0 1 exists $self->{'objects'} ? :
1 0 if $#_ == -1
2710 0 0 exists $self->{'objects'} ? :
0 0 if $#_ == 0
2750 213 602 exists $self->{'parents'} ? :
815 0 if $#_ == -1
2752 0 0 exists $self->{'parents'} ? :
0 0 if $#_ == 0
2766 52 9 exists $self->{'members'} ? :
61 664 if $#_ == -1
2768 518 13 exists $self->{'members'} ? :
531 133 if $#_ == 0
2776 434 56 exists $self->{'members'} ? :
2782 574 79 exists $self->{'members'} ? :
2788 13 48 exists $self->{'udm'} ? :
61 100 if $#_ == -1
2789 21 51 exists $self->{'udm'} ? :
72 28 if $#_ == 0
2797 46 154 exists $self->{'udm'} ? :
2803 70 241 exists $self->{'udm'} ? :
2809 3 120 exists $self->{'class_vars'} ? :
123 0 if $#_ == -1
2812 0 0 exists $self->{'class_vars'} ? :
0 0 if $#_ == 0
2826 12 114 exists $self->{'use_packages'} ? :
126 0 if $#_ == -1
2829 0 0 exists $self->{'use_packages'} ? :
0 0 if $#_ == 0
2844 1836 7 if $#_ == -1
2851 4 57 exists $self->{'private'} ? :
61 2183 if $#_ == -1
2853 221 1956 exists $self->{'private'} ? :
2177 6 if $#_ == 0
2861 4 57 exists $self->{'protected'} ? :
61 1614 if $#_ == -1
2864 179 1426 exists $self->{'protected'} ? :
1605 9 if $#_ == 0
2872 0 0 exists $self->{'required'} ? :
0 681 if $#_ == -1
2874 173 474 exists $self->{'required'} ? :
647 34 if $#_ == 0
2882 0 0 exists $self->{'readonly'} ? :
0 743 if $#_ == -1
2884 128 589 exists $self->{'readonly'} ? :
717 26 if $#_ == 0
2892 429 62 if $#_ == -1
2899 66 0 if $#_ == -1
2906 62 0 if $#_ == -1
2931 0 61 if $#_ == -1
2938 1257 61 if $#_ == -1
2976 51 10 if $form ne ''
2985 13 48 length $form > 0 ? :
2992 0 122 unless defined $w
2993 0 122 unless $w
2994 122 0 if $w =~ /^\d+$/
2995 0 0 unless ref $w
3001 0 0 if ($key eq 'register') { }
0 0 elsif (defined $value and $value) { }
3003 0 0 if $value
3007 0 0 if ($value =~ /^\d+$/) { }
3024 61 0 @warnings_pragmas ? :
3032 61 0 if $self->strict
3033 4 57 if $self->use_packages
3035 61 0 if defined $self->{'check_params'}
3039 1 60 if defined $self->comment
3041 15 46 if $self->parents
3042 1 60 if grep $self->private($_), $self->user_defined_methods_keys
3044 2 59 if $self->private_members_used_in_user_defined_code
3046 1 60 if grep $self->protected($_), $self->user_defined_methods_keys
3048 4 57 if grep $self->protected($_), $self->members_keys
3050 1 60 if $self->class_vars
3052 57 4 if $self->needs_constructor
3056 59 2 unless defined $emr and 'copy' =~ /$emr/
3057 59 0 unless defined $emr and 'equals' =~ /$emr/ or defined $self->user_defined_methods('equals')
3066 1 0 unless ref $var_spec
3069 0 0 ref $value ? :
3077 0 15 !ref($_) ? :
3091 47 379 $not_public ? :
3097 47 379 if $not_public
3108 0 2 $not_public ? :
3114 0 2 if $not_public
3131 116 8 unless @private_members
3170 2 3 $self->protected($_) ? :
3191 53 4 unless @protected_members or @protected_methods
3198 0 4 if ($self->parents) { }
3224 20 39 if (not do { my $has_complex_mems; foreach my $m (@members) { if ($m->isa('Class::Generate::List_Member') or defined $m->base) { $has_complex_mems = 1; last; } ; } ; $has_complex_mems } || $has_parents) { }
3248 14 25 $has_parents ? :
3252 9 30 if $self->can('size_establishment')
3271 2 57 if (@key_members = grep($_->key, @members))
3282 51 0 if ($m->isa('Class::Generate::Hash_Member'), @members)
3290 51 0 if ($m->isa('Class::Generate::Array_Member'), @members)
3296 51 8 if (@local_vars)
3300 14 45 if (@parents)
3315 0 0 unless $self->private($m) or $self->required($m)
3383 2 18 defined $params{'base_index'} ? :
3397 17 0 unless $self->can_assign_all_params
3405 0 0 if $param_indices{$sorted_members[$i]} == $i
3422 127 31 if $#_ != 1
3425 0 31 if (defined($overridden_class = Class::Generate::Support::class_containing_method($_[0], $self))) { }
3507 23 415 $self->private($_[0]) ? :
3515 29 0 unless $self->can_assign_all_params
3517 0 0 if $style->isa('Class::Generate::Key_Value')
3520 0 0 if ($style->isa('Class::Generate::Mix'))
3586 1 0 if ($#self_members == 0) { }
0 0 elsif ($#self_members > 0) { }
3663 38 0 if $class->check_params
3692 5 34 if (not @valid_names) { }
3700 8 26 if ($#valid_names == 0) { }
3739 12 3 exists $self->{'order'} ? :
15 14 if $#_ == -1
3740 14 0 exists $self->{'order'} ? :
14 0 if $#_ == 0
3806 7 0 if $#_ <= 0
3816 8 12 $self->{'pnames'}{$_[0]} ? :
3824 8 12 $self->{'pnames'}{$_[0]} ? :
3830 22 0 exists $self->{'pnames'} ? :
3838 4 0 if $class->check_params
3852 2 2 if $class->parents
3854 2 2 $p % 2 == 0 ? :
3915 5 0 if defined $_[0]
3922 9 0 defined $self->{'super_values'} ? :
3936 3 1 if (@sv = $self->super_values)