Branch Coverage

blib/lib/Class/Generate.pm
Criterion Covered Total %
branch 642 890 72.1


line true false branch
67 6 47 if (defined $params{-'parent'})
73 0 47 if scalar keys %params != 1
77 0 47 if not $allow_redefine_for_class and &$class_defined($class_name)
86 15 0 if (defined($p_spec = $params{-'parent'})) { }
93 0 15 if $@ or scalar $parent->values == 0
95 0 15 if scalar keys %params != 1
99 0 15 if not $allow_redefine_for_class and &$class_defined($class_name)
100 2 13 UNIVERSAL::isa($params{$class_name}, 'ARRAY') ? :
104 0 15 unless defined $c
106 0 15 unless UNIVERSAL::isa($params{$class_name}, $class_to_ref_map{ref $c})
108 0 15 if warnings::enabled() and eval '! exists $' . $p . '::{_cginfo}'
120 0 0 unless eval '%' . $class . '::'
121 0 0 unless (eval '%' . $class . '::_cginfo')
127 0 0 if (eval '%' . $code_checking_package)
449 14 7 if defined $$self{'mem_h'}
4 8 if defined $$self{'mem_a'}
6 0 if exists $$self{'mem_h'}
10 14 if exists $$self{'mem'} ^ exists $$o{'mem'}
9 6 unless $$self{'mem'} eq $$o{'mem'}
4 26 if (exists $$self{'mem'})
7 20 if defined $$self[1] ^ defined $$o[1]
4 23 unless $$self[1] eq $$o[1]
7 10 if (defined $$self[1])
7 20 if exists $$self{'mem_h'} ^ exists $$o{'mem_h'}
2 19 unless $#self_keys == scalar(keys %{$$o{'mem_h'};}) - 1
11 10 unless exists $$o{'mem_h'}{$k}
8 5 if ($self_value_defined = defined $$self{'mem_h'}{$k}) ^ defined $$o{'mem_h'}{$k}
4 3 unless $$self{'mem_h'}{$k} eq $$o{'mem_h'}{$k}
0 4 if ($self_value_defined)
3 2 if (exists $$self{'mem_h'})
1 3 if exists $$self{'mem_a'} ^ exists $$o{'mem_a'}
0 2 unless ($ub = $#{$$self{'mem_a'};}) == $#{$$o{'mem_a'};}
0 3 unless $$self{'mem_a'}[$i] eq $$o{'mem_a'}[$i]
1 4 if (exists $$self{'mem_a'})
2 7 if exists $$self{'mem'} ^ exists $$o{'mem'}
1 5 unless $$self{'mem'} eq $$o{'mem'}
4 3 if (exists $$self{'mem'})
2 4 if defined $$self[1] ^ defined $$o[1]
0 5 unless $$self[1] eq $$o[1]
3 3 if (defined $$self[1])
3 4 exists $$self{'mem_a'} ? :
9 3 if ($#_ == -1)
5 2 if ($#_ == 0)
6 4 if ($#_ == -1)
1 3 if ($#_ == 0)
1 1 if ($#_ == -1)
0 2 if ($#_ == 0)
1 2 if ($#_ == -1)
0 2 if ($#_ == 0)
2 0 exists $$self{'mem_a'} ? :
1 3 if ($#_ == -1)
1 2 exists $$self{'mem_a'} ? :
1 0 if ($#_ == 0)
0 0 if ($#_ == 1)
0 0 exists $$self{'mem_a'} ? :
0 0 exists $$self{'mem_h'} ? :
0 1 if ($#_ == -1)
0 1 exists $$self{'mem_h'} ? :
1 0 if ($#_ == 0)
0 0 if ($#_ == 1)
0 0 exists $$self{'mem_h'} ? :
0 0 exists $$self{'mem_h'} ? :
1 26 if $#_ % 2 == 0
1 26 if @unknown_params
8 15 if exists $params{'mem'}
4 48 if $#_ % 2 == 0
6 48 if @unknown_params
15 21 unless not exists $params{'mem_h'} or UNIVERSAL::isa($params{'mem_h'}, 'HASH')
3 15 unless not exists $params{'mem_a'} or UNIVERSAL::isa($params{'mem_a'}, 'ARRAY')
5 17 if exists $params{'mem_h'}
3 11 if exists $params{'mem_a'}
9 66 unless ref $proto
24 42 if $#_ % 2 == 0
10 35 if @unknown_params
11 14 if exists $params{'mem'}
7 21 if $#_ % 2 == 0
0 34 if @unknown_params
5 31 if exists $params{'mem'}
3 22 if $#_ % 2 == 0
6 25 if @unknown_params
1 24 if exists $params{'mem'}
4 5 if defined $$self[1]
4 11 if defined $$self[2]
7 1 if defined $$self[3]
5 3 if defined $$self[1]
0 3 if defined $$self[1]
7 2 if defined $$self[1]
2 0 if defined $$self[1]
3 1 if defined $$self[3]
2 3 if defined $$self[3]
0 0 if defined $$self[3] ^ defined $$o[3]
0 0 unless $#self_keys == scalar(keys %{$$o[3];}) - 1
0 0 unless exists $$o[3]{$k}
0 1 if ($self_value_defined = defined $$self[3]{$k}) ^ defined $$o[3]{$k}
1 0 unless $$self[3]{$k} eq $$o[3]{$k}
2 1 if ($self_value_defined)
3 5 if (defined $$self[3])
2 0 if defined $$self[1] ^ defined $$o[1]
2 2 unless ($ub = $#{$$self[1];}) == $#{$$o[1];}
0 2 unless $$self[1][$i] eq $$o[1][$i]
4 1 if (defined $$self[1])
0 1 if defined $$self[2] ^ defined $$o[2]
1 0 unless $$self[2] eq $$o[2]
1 0 if (defined $$self[2])
1 1 defined $$self[1] ? :
0 0 defined $$self[2] ? :
1 1 defined $$self[3] ? :
2 6 defined $$self[3] ? :
2 0 defined $$self[2] ? :
2 2 defined $$self[2] ? :
0 2 if ($#_ == -1)
4 2 if ($#_ == 0)
2 0 if ($#_ == -1)
1 1 if ($#_ == 0)
2 1 if ($#_ == -1)
0 0 if ($#_ == 0)
0 1 if ($#_ == -1)
0 1 if ($#_ == 0)
1 0 if ($#_ == -1)
0 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[1] ? :
4 0 if ($#_ == -1)
0 0 defined $$self[1] ? :
1 0 unless ref $_[0]
0 0 unless UNIVERSAL::isa($_[0], 'ARRAY')
4 2 if ($#_ == 0)
2 0 if ($#_ == 1)
2 1 defined $$self[2] ? :
0 1 if ($#_ == -1)
1 0 defined $$self[2] ? :
0 0 unless ref $_[0]
0 0 unless UNIVERSAL::isa($_[0], 'ARRAY')
0 0 if ($#_ == 0)
0 0 if ($#_ == 1)
0 0 defined $$self[2] ? :
0 0 if ($#_ == -1)
568 36 20 if exists $classes{$class_name}
570 2 18 unless eval '%' . $class_name . '::'
573 5 2 unless (eval 'exists $' . $class_name . '::{_cginfo}')
574 2 19 unless defined $default_type
575 0 10 if ($default_type eq 'ARRAY') { }
588 1 19 if ($info{'base'} eq 'ARRAY') { }
594 0 1 if (exists $info{'members'})
599 6 14 if ($mem_info{'type'} eq '$')
600 6 7 if ($mem_info{'type'} eq '@')
601 2 2 if ($mem_info{'type'} eq '%')
603 4 1 if exists $mem_info{'base'}
607 1 0 if (exists $info{'class_methods'})
612 1 2 if (exists $info{'instance_methods'})
617 0 2 if (exists $info{'protected'})
622 1 2 if (exists $info{'private'})
627 0 2 if exists $info{'emr'}
630 2 1 if (exists $info{'kv_style'})
634 1 0 if (exists $info{'pos_style'})
638 0 1 if (exists $info{'mix_style'})
644 0 2 if (exists $info{'own_style'})
661 19 44 if ($class->isa('Class::Generate::Array_Class')) { }
668 52 11 if (my(@members) = $class->members_values)
673 2 28 if ($m->isa('Class::Generate::Class_Method')) { }
685 8 56 if (my $emr = $class->excluded_methods_regexp)
689 61 3 if (my $constructor = $class->constructor)
692 41 22 if ($style->isa('Class::Generate::Key_Value'))
694 33 10 if (@kpn) { }
702 10 11 if ($style->isa('Class::Generate::Positional'))
704 9 2 if (@members) { }
712 5 8 if ($style->isa('Class::Generate::Mix'))
715 4 4 if (@keyed_members or @pos_members) { }
725 5 3 if ($style->isa('Class::Generate::Own'))
727 5 5 if (@super_values) { }
748 31 33 $member->isa('Class::Generate::Array_Member') ? :
72 64 $member->isa('Class::Generate::Scalar_Member') ? :
750 16 120 if (defined($base = $member->base))
758 1 77 unless @list
763 71 223 $#_ > 0 ? :
788 3 60 if (not @names) { }
797 2 59 if (not @names) { }
806 47 14 if (not @names) { }
814 2 59 if ($class->class_methods) { }
817 1 1 if (not @names) { }
829 0 61 if (my(@private_class_methods) = grep(($_->isa('Class::Generate::Class_Method') && $class->private($_->name)), $class->user_defined_methods)) { }
845 46 2 if defined $member_regexp
846 44 2 if defined $accessor_regexp
847 34 12 if defined $user_defined_methods_regexp
848 0 46 if defined $private_class_methods_regexp
855 0 91 if $match =~ /\A(?:my|local)\b[^=;()]+$member_reference$/s
858 0 91 unless defined($index = member_index($class, $name))
861 72 22 $type eq '$' ? :
868 3 31 unless ($c->protected($element_name) or $c->private($element_name))
869 0 5 substr($match, -1) eq '(' ? :
871 27 7 if ($c->private($element_name) or $c->name eq $class->name)
872 8 19 if substr($match, -1) eq '('
877 3 3 substr($match, -1) eq '(' ? :
884 0 2 if (defined $nonpublic_member_regexp and @objs = $method->objects)
890 3 2 if (defined $private_class_methods_regexp)
899 0 0 if (defined $paren_matter) { }
900 0 0 if (index($paren_matter, ')') != -1) { }
915 91 12 if defined $class->members($member_name)
918 12 0 if defined $index
926 15 61 if ($disallow_private_members) { }
939 15 61 if ($disallow_private_members) { }
952 3 165 if $class->private($member_name = $member->name) and $disallow_private_members
963 15 61 $disallow_private_methods ? :
969 33 6 if defined $class->members($element_name) || defined $class->user_defined_methods($element_name) and not $disallow_private_members && $class->private($element_name)
972 6 0 if defined $c
996 133 165 $seen{$_->name} ? :
1004 0 194 if (defined($code = $member->pre))
1013 15 181 if (defined($code = $member->post))
1015 0 13 if (defined $pre and not $problems_in_pre)
1024 6 190 if (defined($code = $member->assert))
1032 4 26 if ($method->isa('Class::Generate::Class_Method')) { }
1046 63 0 if $class->strict
1048 64 0 if ($class->check_params)
1053 17 46 if $class->parents
1064 1 46 if $@
1077 4 42 if ($#$class_vars >= 0)
1078 0 4 ref $_ ? :
1080 42 4 if ($valid_vars and $#$valid_vars >= 0)
1093 61 3 if (not ref $_[0]) { }
3 0 elsif (UNIVERSAL::isa($_[0], 'ARRAY')) { }
1119 104 58 if (not ref $value) { }
1123 0 58 unless UNIVERSAL::isa($value, 'HASH')
1124 1 57 unless exists $$value{$key}
1137 15 0 ref $parent ? :
1138 15 0 if (exists $stab{$method} and do { local *method_entry = $stab{$method}; defined &method_entry })
1151 0 1 if ($type =~ /^\w/) { }
1157 1 0 if $type eq '$'
1160 0 0 ref $value ? :
1161 0 0 if not UNIVERSAL::isa($result, $map{$type})
1168 1 0 if substr($comment, -1, 1) ne "\n"
1174 1 7 $#vars == 0 ? :
1192 227 1 if $#_ == -1
1197 886 0 if $#_ == -1
1202 553 3 if $#_ == -1
1207 493 4 if $#_ == -1
1212 420 0 if $#_ == -1
1217 0 4 unless ($code =~ /[;\}]\s*\Z/s)
1228 131 3 if $#_ == -1
1233 96 2 if $#_ == -1
1240 0 7 unless defined $assertion
1252 31 53 if ($class->required($name) and not $self->default)
1253 6 25 if $self->can_be_invalid
1256 53 0 if ($self->can_be_invalid)
1269 31 53 if ($class->required($name) and not $self->default) { }
53 0 elsif ($self->can_be_invalid) { }
1271 6 25 if $self->can_be_invalid
1285 61 71 if $self->can('lvalue')
1286 61 71 if $self->can('values')
1289 0 132 if defined $self->comment
1291 132 0 if ($class->include_method($member_name))
1296 132 0 if $class->check_params
1300 90 178 unless $a =~ s/^([a-z]+)_$member_name$/$1_form/
1325 106 0 if ($class->check_params) { }
1338 220 95 !($class->readonly($name) || $class->required($name)) ? :
1369 0 118 if (defined $default) { }
31 87 elsif ($class->check_params and $class->required($name)) { }
1397 24 47 $class->readonly($self->name) ? :
1402 0 71 if ($class->readonly($self->name) and not $class->check_params)
1411 0 47 if defined $self->pre
1412 6 41 if $class->check_params and defined $self->base
1414 4 43 if defined $self->post
1415 2 45 if defined $class->check_params and defined $self->assert
1439 99 0 $class->include_method($self->name) ? :
1455 37 0 unless ($self->nocopy)
1456 6 31 if $self->base
1468 5 65 if ($self->base) { }
1485 2 59 $class->readonly($self->name) ? :
1496 59 2 if ($class->accept_refs) { }
1499 2 57 if ($class->check_params and $class->readonly($self->name)) { }
1503 0 57 if defined $self->pre
1504 57 0 if $class->check_params
1506 0 57 if defined $self->post
1507 0 57 if defined $class->check_params and defined $self->assert
1521 0 59 if defined $self->pre
1522 10 49 if $class->check_params and defined $self->base
1524 0 59 if defined $self->post
1535 20 90 if (defined $base)
1596 5 25 if $class->check_params and defined $self->base
1597 0 30 if defined $self->pre
1599 0 30 if defined $self->post
1600 0 30 if defined $class->check_params and defined $self->assert
1612 34 0 $class->include_method($self->name) ? :
1618 70 2 unless $class->readonly($name)
1623 15 24 if (defined $self->base) { }
1635 29 1 if (not $self->nocopy) { }
1637 5 24 if $self->base
1656 3 24 if ($self->base) { }
1708 32 0 $class->include_method($self->name) ? :
1714 66 2 unless $class->readonly($name)
1719 10 23 if (defined $self->base) { }
1730 28 1 if (not $self->nocopy) { }
1731 5 23 if ($self->base) { }
1760 3 22 if ($self->base) { }
1782 297 61 if $#_ == -1
1787 1 51 exists $$self{'constraints'} ? :
52 0 if $#_ == -1
1788 0 0 exists $$self{'constraints'} ? :
0 0 if $#_ == 0
1797 0 0 exists $$self{'constraints'} ? :
1811 45 12 if (not $class->parents and $style->can('params_check_form'))
1814 52 5 unless ($style->isa('Class::Generate::Own'))
1816 84 34 $_->param_must_be_checked($class) ? :
1829 2 55 if defined $class->check_params and defined $self->assert
1841 1 56 $class->nfi ? :
1845 1 56 if ($class->check_params and $class->virtual)
1848 42 15 if not $class->can_assign_all_params and $style->can('init_form')
1850 57 0 if $class->check_params
1851 11 46 if (defined $class->parents) { }
1858 57 0 unless ($class->can_assign_all_params)
1859 17 40 if $class->can('size_establishment')
1860 52 5 unless ($style->isa('Class::Generate::Own'))
1871 9 48 if defined $self->post
1872 57 0 if $class->check_params
1899 26 0 if $#_ == -1
1907 0 26 if defined $self->comment
1919 0 1 exists $$self{'objects'} ? :
1 0 if $#_ == -1
1920 0 0 exists $$self{'objects'} ? :
0 0 if $#_ == 0
1950 213 602 exists $$self{'parents'} ? :
815 0 if $#_ == -1
1951 0 0 exists $$self{'parents'} ? :
0 0 if $#_ == 0
1960 52 9 exists $$self{'members'} ? :
61 664 if $#_ == -1
1961 518 13 exists $$self{'members'} ? :
531 133 if $#_ == 0
1966 434 56 exists $$self{'members'} ? :
1970 574 79 exists $$self{'members'} ? :
1974 13 48 exists $$self{'udm'} ? :
61 100 if $#_ == -1
1975 21 51 exists $$self{'udm'} ? :
72 28 if $#_ == 0
1980 46 154 exists $$self{'udm'} ? :
1984 70 241 exists $$self{'udm'} ? :
1988 3 120 exists $$self{'class_vars'} ? :
123 0 if $#_ == -1
1989 0 0 exists $$self{'class_vars'} ? :
0 0 if $#_ == 0
1998 12 114 exists $$self{'use_packages'} ? :
126 0 if $#_ == -1
1999 0 0 exists $$self{'use_packages'} ? :
0 0 if $#_ == 0
2008 1836 7 if $#_ == -1
2013 4 57 exists $$self{'private'} ? :
61 2183 if $#_ == -1
2014 221 1956 exists $$self{'private'} ? :
2177 6 if $#_ == 0
2019 4 57 exists $$self{'protected'} ? :
61 1614 if $#_ == -1
2020 179 1426 exists $$self{'protected'} ? :
1605 9 if $#_ == 0
2025 0 0 exists $$self{'required'} ? :
0 681 if $#_ == -1
2026 173 474 exists $$self{'required'} ? :
647 34 if $#_ == 0
2031 0 0 exists $$self{'readonly'} ? :
0 743 if $#_ == -1
2032 128 589 exists $$self{'readonly'} ? :
717 26 if $#_ == 0
2037 429 62 if $#_ == -1
2042 66 0 if $#_ == -1
2047 62 0 if $#_ == -1
2064 0 61 if $#_ == -1
2069 1257 61 if $#_ == -1
2092 51 10 if $form ne ''
2099 13 48 length $form > 0 ? :
2105 0 122 unless defined $w
2106 0 122 unless $w
2107 122 0 if $w =~ /^\d+$/
2108 0 0 unless ref $w
2113 0 0 if ($key eq 'register') { }
0 0 elsif (defined $value and $value) { }
2114 0 0 if $value
2117 0 0 if ($value =~ /^\d+$/) { }
2131 61 0 @warnings_pragmas ? :
2138 61 0 if $self->strict
2139 4 57 if $self->use_packages
2140 61 0 if defined $$self{'check_params'}
2144 1 60 if defined $self->comment
2145 15 46 if $self->parents
2146 1 60 if grep $self->private($_), $self->user_defined_methods_keys
2147 2 59 if $self->private_members_used_in_user_defined_code
2148 1 60 if grep $self->protected($_), $self->user_defined_methods_keys
2149 4 57 if grep $self->protected($_), $self->members_keys
2150 1 60 if $self->class_vars
2151 57 4 if $self->needs_constructor
2155 59 2 unless defined $emr and 'copy' =~ /$emr/
2156 59 0 unless defined $emr and 'equals' =~ /$emr/ or defined $self->user_defined_methods('equals')
2163 1 0 unless ref $var_spec
2165 0 0 ref $value ? :
2171 0 15 !ref($_) ? :
2181 47 379 $not_public ? :
2185 47 379 if $not_public
2194 0 2 $not_public ? :
2198 0 2 if $not_public
2211 116 8 unless @private_members
2238 2 3 $self->protected($_) ? :
2248 53 4 unless @protected_members or @protected_methods
2252 0 4 if ($self->parents) { }
2272 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) { }
2284 14 25 $has_parents ? :
2285 9 30 if $self->can('size_establishment')
2302 2 57 if (@key_members = grep($_->key, @members))
2310 51 0 if ($m->isa('Class::Generate::Hash_Member'), @members)
2316 51 0 if ($m->isa('Class::Generate::Array_Member'), @members)
2321 51 8 if (@local_vars)
2324 14 45 if (@parents)
2336 0 0 unless $self->private($m) or $self->required($m)
2386 2 18 defined $params{'base_index'} ? :
2397 17 0 unless $self->can_assign_all_params
2401 0 0 if $param_indices{$sorted_members[$i]} == $i
2411 127 31 if $#_ != 1
2414 0 31 if (defined($overridden_class = Class::Generate::Support::class_containing_method($_[0], $self))) { }
2465 23 415 $self->private($_[0]) ? :
2469 29 0 unless $self->can_assign_all_params
2471 0 0 if $style->isa('Class::Generate::Key_Value')
2474 0 0 if ($style->isa('Class::Generate::Mix'))
2519 1 0 if ($#self_members == 0) { }
0 0 elsif ($#self_members > 0) { }
2573 38 0 if $class->check_params
2593 5 34 if (not @valid_names) { }
2598 8 26 if ($#valid_names == 0) { }
2626 12 3 exists $$self{'order'} ? :
15 12 if $#_ == -1
2627 12 0 exists $$self{'order'} ? :
12 0 if $#_ == 0
2673 7 0 if $#_ <= 0
2679 8 12 $$self{'pnames'}{$_[0]} ? :
2683 8 12 $$self{'pnames'}{$_[0]} ? :
2687 22 0 exists $$self{'pnames'} ? :
2693 4 0 if $class->check_params
2703 2 2 if $class->parents
2704 2 2 $p % 2 == 0 ? :
2748 5 0 if defined $_[0]
2754 9 0 defined $$self{'super_values'} ? :
2766 3 1 if (@sv = $self->super_values)