Branch Coverage

blib/lib/Class/Generate.pm
Criterion Covered Total %
branch 631 890 70.9


line true false branch
66 6 47 if (defined $params{'-parent'})
72 0 47 if scalar keys %params != 1
76 0 47 if not $allow_redefine_for_class and &$class_defined($class_name)
85 15 0 if (defined($p_spec = $params{'-parent'})) { }
92 0 15 if $@ or scalar $parent->values == 0
94 0 15 if scalar keys %params != 1
98 0 15 if not $allow_redefine_for_class and &$class_defined($class_name)
99 2 13 UNIVERSAL::isa($params{$class_name}, 'ARRAY') ? :
103 0 15 unless defined $c
106 0 15 unless UNIVERSAL::isa($params{$class_name}, $class_to_ref_map{ref $c})
107 0 15 if warnings::enabled() and eval '! exists $' . $p . '::{_cginfo}'
119 0 0 unless eval '%' . $class . '::'
120 0 0 unless (eval '%' . $class . '::_cginfo')
126 0 0 if (eval '%' . $code_checking_package)
448 4 7 if defined $self->{'mem_a'}
3 8 if defined $self->{'mem_h'}
13 8 if exists $self->{'mem_h'}
9 6 if exists $self->{'mem'} ^ exists $o->{'mem'}
5 12 unless $self->{'mem'} eq $o->{'mem'}
10 1 if (exists $self->{'mem'})
3 22 if defined $self->[1] ^ defined $o->[1]
4 19 unless $self->[1] eq $o->[1]
9 16 if (defined $self->[1])
7 11 if defined $self->[1] ^ defined $o->[1]
0 16 unless $self->[1] eq $o->[1]
1 17 if (defined $self->[1])
15 12 if exists $self->{'mem'} ^ exists $o->{'mem'}
2 15 unless $self->{'mem'} eq $o->{'mem'}
1 15 if (exists $self->{'mem'})
12 4 if exists $self->{'mem_a'} ^ exists $o->{'mem_a'}
5 6 unless ($ub = $#{$$self{'mem_a'};}) == $#{$$o{'mem_a'};}
4 3 unless $self->{'mem_a'}[$i] eq $o->{'mem_a'}[$i]
2 1 if (exists $self->{'mem_a'})
1 3 if exists $self->{'mem_h'} ^ exists $o->{'mem_h'}
1 3 unless $#self_keys == scalar(keys %{$$o{'mem_h'};}) - 1
0 5 unless exists $o->{'mem_h'}{$k}
0 3 if ($self_value_defined = defined $self->{'mem_h'}{$k}) ^ defined $o->{'mem_h'}{$k}
0 4 unless $self->{'mem_h'}{$k} eq $o->{'mem_h'}{$k}
2 2 if ($self_value_defined)
1 2 if (exists $self->{'mem_h'})
2 1 exists $self->{'mem_a'} ? :
11 3 if ($#_ == -1)
6 3 if ($#_ == 0)
3 3 if ($#_ == -1)
1 3 if ($#_ == 0)
1 2 if ($#_ == -1)
1 0 if ($#_ == 0)
1 1 if ($#_ == -1)
0 1 if ($#_ == 0)
1 0 exists $self->{'mem_a'} ? :
0 2 if ($#_ == -1)
0 2 exists $self->{'mem_a'} ? :
1 2 if ($#_ == 0)
1 0 if ($#_ == 1)
0 0 exists $self->{'mem_a'} ? :
0 0 exists $self->{'mem_h'} ? :
0 1 if ($#_ == -1)
1 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'} ? :
0 49 if $#_ % 2 == 0
13 37 if @unknown_params
2 32 if exists $params{'mem'}
3 65 if $#_ % 2 == 0
18 42 if @unknown_params
19 21 if exists $params{'mem'}
4 44 if $#_ % 2 == 0
9 42 if @unknown_params
7 27 if exists $params{'mem'}
8 49 if $#_ % 2 == 0
6 47 if @unknown_params
16 35 unless not exists $params{'mem_a'} or UNIVERSAL::isa($params{'mem_a'}, 'ARRAY')
6 32 unless not exists $params{'mem_h'} or UNIVERSAL::isa($params{'mem_h'}, 'HASH')
5 17 if exists $params{'mem_a'}
0 13 if exists $params{'mem_h'}
8 9 unless ref $proto
7 11 if $#_ % 2 == 0
7 11 if @unknown_params
3 13 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->[3]
7 2 if defined $self->[2]
2 0 if defined $self->[1]
3 1 if defined $self->[3]
2 3 if defined $self->[2]
0 0 if defined $self->[2] ^ defined $o->[2]
0 0 unless $self->[2] eq $o->[2]
0 0 if (defined $self->[2])
0 1 if defined $self->[3] ^ defined $o->[3]
1 0 unless $#self_keys == scalar(keys %{$$o[3];}) - 1
2 1 unless exists $o->[3]{$k}
3 5 if ($self_value_defined = defined $self->[3]{$k}) ^ defined $o->[3]{$k}
2 0 unless $self->[3]{$k} eq $o->[3]{$k}
2 2 if ($self_value_defined)
0 2 if (defined $self->[3])
4 1 if defined $self->[1] ^ defined $o->[1]
0 1 unless ($ub = $#{$$self[1];}) == $#{$$o[1];}
1 0 unless $self->[1][$i] eq $o->[1][$i]
1 0 if (defined $self->[1])
1 1 defined $self->[3] ? :
0 0 defined $self->[1] ? :
2 2 defined $self->[1] ? :
4 5 defined $self->[1] ? :
2 0 defined $self->[3] ? :
2 3 defined $self->[3] ? :
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->[1] ? :
7 2 if ($#_ == -1)
0 2 defined $self->[1] ? :
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->[3] ? :
0 1 if ($#_ == -1)
1 0 defined $self->[3] ? :
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)
568 36 3 if exists $classes{$class_name}
570 4 19 unless eval '%' . $class_name . '::'
573 2 2 unless (eval 'exists $' . $class_name . '::{_cginfo}')
574 1 18 unless defined $default_type
575 6 8 if ($default_type eq 'ARRAY') { }
588 1 1 if ($info{'base'} eq 'ARRAY') { }
594 0 1 if (exists $info{'members'})
599 0 0 if ($mem_info{'type'} eq '$')
600 0 0 if ($mem_info{'type'} eq '@')
601 2 1 if ($mem_info{'type'} eq '%')
603 0 1 if exists $mem_info{'base'}
607 0 1 if (exists $info{'class_methods'})
612 0 1 if (exists $info{'instance_methods'})
617 0 1 if (exists $info{'protected'})
622 0 1 if (exists $info{'private'})
627 1 2 if exists $info{'emr'}
630 0 2 if (exists $info{'kv_style'})
634 0 2 if (exists $info{'pos_style'})
638 0 2 if (exists $info{'mix_style'})
644 0 0 if (exists $info{'own_style'})
661 19 42 if ($class->isa('Class::Generate::Array_Class')) { }
668 52 9 if (my(@members) = $class->members_values)
673 4 29 if ($m->isa('Class::Generate::Class_Method')) { }
685 7 57 if (my $emr = $class->excluded_methods_regexp)
689 61 1 if (my $constructor = $class->constructor)
692 41 23 if ($style->isa('Class::Generate::Key_Value'))
694 33 11 if (@kpn) { }
702 10 13 if ($style->isa('Class::Generate::Positional'))
704 9 4 if (@members) { }
712 6 6 if ($style->isa('Class::Generate::Mix'))
715 5 3 if (@keyed_members or @pos_members) { }
725 5 1 if ($style->isa('Class::Generate::Own'))
727 3 3 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 3 78 unless @list
763 68 224 $#_ > 0 ? :
789 2 62 if (not @names) { }
798 2 62 if (not @names) { }
807 47 17 if (not @names) { }
815 5 59 if ($class->class_methods) { }
818 1 1 if (not @names) { }
830 0 64 if (my(@private_class_methods) = grep(($_->isa('Class::Generate::Class_Method') && $class->private($_->name)), $class->user_defined_methods)) { }
846 45 2 if defined $member_regexp
847 45 3 if defined $accessor_regexp
848 36 13 if defined $user_defined_methods_regexp
849 0 46 if defined $private_class_methods_regexp
856 0 91 if $match =~ /\A(?:my|local)\b[^=;()]+$member_reference$/s
859 3 91 unless defined($index = &member_index($class, $name))
862 69 22 $type eq '$' ? :
869 2 31 unless ($c->protected($element_name) or $c->private($element_name))
870 0 2 substr($match, -1) eq '(' ? :
872 25 6 if ($c->private($element_name) or $c->name eq $class->name)
873 7 18 if substr($match, -1) eq '('
878 3 3 substr($match, -1) eq '(' ? :
885 2 2 if (defined $nonpublic_member_regexp and @objs = $method->objects)
891 0 2 if (defined $private_class_methods_regexp)
900 0 0 if (defined $paren_matter) { }
901 0 0 if (index($paren_matter, ')') != -1) { }
916 91 12 if defined $class->members($member_name)
919 12 0 if defined $index
927 15 61 if ($disallow_private_members) { }
940 17 61 if ($disallow_private_members) { }
953 2 165 if $class->private($member_name = $member->name) and $disallow_private_members
964 18 61 $disallow_private_methods ? :
970 34 6 if defined $class->members($element_name) || defined $class->user_defined_methods($element_name) and not $disallow_private_members && $class->private($element_name)
973 7 0 if defined $c
998 135 165 $seen{$_->name} ? :
1006 1 194 if (defined($code = $member->pre))
1015 13 182 if (defined($code = $member->post))
1017 0 13 if (defined $pre and not $problems_in_pre)
1026 6 189 if (defined($code = $member->assert))
1034 3 26 if ($method->isa('Class::Generate::Class_Method')) { }
1048 61 0 if $class->strict
1050 62 0 if ($class->check_params)
1055 15 46 if $class->parents
1066 0 46 if $@
1079 4 42 if ($#$class_vars >= 0)
1080 0 4 ref $_ ? :
1082 42 4 if ($valid_vars and $#$valid_vars >= 0)
1096 60 3 if (not ref $_[0]) { }
3 0 elsif (UNIVERSAL::isa($_[0], 'ARRAY')) { }
1123 104 58 if (not ref $value) { }
1127 0 58 unless UNIVERSAL::isa($value, 'HASH')
1128 1 57 unless exists $value->{$key}
1142 15 0 ref $parent ? :
1143 15 0 if (exists $stab{$method} and do { local *method_entry = $stab{$method}; defined &method_entry })
1156 0 1 if ($type =~ /^\w/) { }
1162 2 0 if $type eq '$'
1165 0 0 ref $value ? :
1166 0 0 if not UNIVERSAL::isa($result, $map{$type})
1173 1 0 if substr($comment, -1, 1) ne "\n"
1179 1 7 $#vars == 0 ? :
1198 227 1 if $#_ == -1
1203 879 0 if $#_ == -1
1208 553 3 if $#_ == -1
1213 493 4 if $#_ == -1
1218 420 0 if $#_ == -1
1223 0 4 unless ($code =~ /[;\}]\s*\Z/s)
1234 131 3 if $#_ == -1
1239 96 2 if $#_ == -1
1246 0 7 unless defined $assertion
1258 31 53 if ($class->required($name) and not $self->default)
1259 6 25 if $self->can_be_invalid
1262 53 0 if ($self->can_be_invalid)
1275 31 53 if ($class->required($name) and not $self->default) { }
53 0 elsif ($self->can_be_invalid) { }
1277 6 25 if $self->can_be_invalid
1291 61 71 if $self->can('lvalue')
1292 61 71 if $self->can('values')
1295 0 132 if defined $self->comment
1297 132 0 if ($class->include_method($member_name))
1302 132 0 if $class->check_params
1306 90 178 unless $a =~ s/^([a-z]+)_$member_name$/$1_form/
1331 106 0 if ($class->check_params) { }
1344 220 95 !($class->readonly($name) || $class->required($name)) ? :
1375 0 118 if (defined $default) { }
31 87 elsif ($class->check_params and $class->required($name)) { }
1404 24 47 $class->readonly($self->name) ? :
1409 0 71 if ($class->readonly($self->name) and not $class->check_params)
1418 0 47 if defined $self->pre
1419 6 41 if $class->check_params and defined $self->base
1421 4 43 if defined $self->post
1422 2 45 if defined $class->check_params and defined $self->assert
1446 99 0 $class->include_method($self->name) ? :
1462 37 0 unless ($self->nocopy)
1463 6 31 if $self->base
1475 5 65 if ($self->base) { }
1493 2 59 $class->readonly($self->name) ? :
1504 59 2 if ($class->accept_refs) { }
1507 2 57 if ($class->check_params and $class->readonly($self->name)) { }
1511 0 57 if defined $self->pre
1512 57 0 if $class->check_params
1514 0 57 if defined $self->post
1515 0 57 if defined $class->check_params and defined $self->assert
1529 0 59 if defined $self->pre
1530 10 49 if $class->check_params and defined $self->base
1532 0 59 if defined $self->post
1543 20 90 if (defined $base)
1605 5 25 if $class->check_params and defined $self->base
1606 0 30 if defined $self->pre
1608 0 30 if defined $self->post
1609 0 30 if defined $class->check_params and defined $self->assert
1621 34 0 $class->include_method($self->name) ? :
1627 70 2 unless $class->readonly($name)
1632 15 24 if (defined $self->base) { }
1644 29 1 if (not $self->nocopy) { }
1646 5 24 if $self->base
1665 3 24 if ($self->base) { }
1718 32 0 $class->include_method($self->name) ? :
1724 66 2 unless $class->readonly($name)
1729 10 23 if (defined $self->base) { }
1740 28 1 if (not $self->nocopy) { }
1741 5 23 if ($self->base) { }
1770 3 22 if ($self->base) { }
1793 297 61 if $#_ == -1
1798 1 51 exists $self->{'constraints'} ? :
52 0 if $#_ == -1
1799 0 0 exists $self->{'constraints'} ? :
0 0 if $#_ == 0
1808 0 0 exists $self->{'constraints'} ? :
1822 45 12 if (not $class->parents and $style->can('params_check_form'))
1825 52 5 unless ($style->isa('Class::Generate::Own'))
1827 84 34 $_->param_must_be_checked($class) ? :
1840 2 55 if defined $class->check_params and defined $self->assert
1852 1 56 $class->nfi ? :
1856 1 56 if ($class->check_params and $class->virtual)
1859 42 15 if not $class->can_assign_all_params and $style->can('init_form')
1861 57 0 if $class->check_params
1862 11 46 if (defined $class->parents) { }
1869 57 0 unless ($class->can_assign_all_params)
1870 17 40 if $class->can('size_establishment')
1871 52 5 unless ($style->isa('Class::Generate::Own'))
1882 9 48 if defined $self->post
1883 57 0 if $class->check_params
1911 26 0 if $#_ == -1
1919 0 26 if defined $self->comment
1932 0 1 exists $self->{'objects'} ? :
1 0 if $#_ == -1
1933 0 0 exists $self->{'objects'} ? :
0 0 if $#_ == 0
1964 213 602 exists $self->{'parents'} ? :
815 0 if $#_ == -1
1965 0 0 exists $self->{'parents'} ? :
0 0 if $#_ == 0
1974 52 9 exists $self->{'members'} ? :
61 664 if $#_ == -1
1975 518 13 exists $self->{'members'} ? :
531 133 if $#_ == 0
1980 434 56 exists $self->{'members'} ? :
1984 574 79 exists $self->{'members'} ? :
1988 13 48 exists $self->{'udm'} ? :
61 100 if $#_ == -1
1989 21 51 exists $self->{'udm'} ? :
72 28 if $#_ == 0
1994 46 154 exists $self->{'udm'} ? :
1998 70 241 exists $self->{'udm'} ? :
2002 3 120 exists $self->{'class_vars'} ? :
123 0 if $#_ == -1
2003 0 0 exists $self->{'class_vars'} ? :
0 0 if $#_ == 0
2012 12 114 exists $self->{'use_packages'} ? :
126 0 if $#_ == -1
2013 0 0 exists $self->{'use_packages'} ? :
0 0 if $#_ == 0
2022 1836 7 if $#_ == -1
2027 4 57 exists $self->{'private'} ? :
61 2183 if $#_ == -1
2028 221 1956 exists $self->{'private'} ? :
2177 6 if $#_ == 0
2033 4 57 exists $self->{'protected'} ? :
61 1614 if $#_ == -1
2034 179 1426 exists $self->{'protected'} ? :
1605 9 if $#_ == 0
2039 0 0 exists $self->{'required'} ? :
0 681 if $#_ == -1
2040 173 474 exists $self->{'required'} ? :
647 34 if $#_ == 0
2045 0 0 exists $self->{'readonly'} ? :
0 743 if $#_ == -1
2046 128 589 exists $self->{'readonly'} ? :
717 26 if $#_ == 0
2051 429 62 if $#_ == -1
2056 66 0 if $#_ == -1
2061 62 0 if $#_ == -1
2078 0 61 if $#_ == -1
2083 1257 61 if $#_ == -1
2106 51 10 if $form ne ''
2113 13 48 length $form > 0 ? :
2119 0 122 unless defined $w
2120 0 122 unless $w
2121 122 0 if $w =~ /^\d+$/
2122 0 0 unless ref $w
2127 0 0 if ($key eq 'register') { }
0 0 elsif (defined $value and $value) { }
2128 0 0 if $value
2131 0 0 if ($value =~ /^\d+$/) { }
2145 61 0 @warnings_pragmas ? :
2152 61 0 if $self->strict
2153 4 57 if $self->use_packages
2154 61 0 if defined $self->{'check_params'}
2158 1 60 if defined $self->comment
2159 15 46 if $self->parents
2160 1 60 if grep $self->private($_), $self->user_defined_methods_keys
2161 2 59 if $self->private_members_used_in_user_defined_code
2162 1 60 if grep $self->protected($_), $self->user_defined_methods_keys
2163 4 57 if grep $self->protected($_), $self->members_keys
2164 1 60 if $self->class_vars
2165 57 4 if $self->needs_constructor
2169 59 2 unless defined $emr and 'copy' =~ /$emr/
2170 59 0 unless defined $emr and 'equals' =~ /$emr/ or defined $self->user_defined_methods('equals')
2177 1 0 unless ref $var_spec
2179 0 0 ref $value ? :
2185 0 15 !ref($_) ? :
2195 47 379 $not_public ? :
2199 47 379 if $not_public
2208 0 2 $not_public ? :
2212 0 2 if $not_public
2225 116 8 unless @private_members
2252 2 3 $self->protected($_) ? :
2262 53 4 unless @protected_members or @protected_methods
2266 0 4 if ($self->parents) { }
2286 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) { }
2298 14 25 $has_parents ? :
2299 9 30 if $self->can('size_establishment')
2316 2 57 if (@key_members = grep($_->key, @members))
2324 51 0 if ($m->isa('Class::Generate::Hash_Member'), @members)
2330 51 0 if ($m->isa('Class::Generate::Array_Member'), @members)
2335 51 8 if (@local_vars)
2338 14 45 if (@parents)
2350 0 0 unless $self->private($m) or $self->required($m)
2401 2 18 defined $params{'base_index'} ? :
2412 17 0 unless $self->can_assign_all_params
2416 0 0 if $param_indices{$sorted_members[$i]} == $i
2426 127 31 if $#_ != 1
2429 0 31 if (defined($overridden_class = Class::Generate::Support::class_containing_method($_[0], $self))) { }
2481 23 415 $self->private($_[0]) ? :
2485 29 0 unless $self->can_assign_all_params
2487 0 0 if $style->isa('Class::Generate::Key_Value')
2490 0 0 if ($style->isa('Class::Generate::Mix'))
2536 1 0 if ($#self_members == 0) { }
0 0 elsif ($#self_members > 0) { }
2591 38 0 if $class->check_params
2611 5 34 if (not @valid_names) { }
2616 8 26 if ($#valid_names == 0) { }
2645 12 3 exists $self->{'order'} ? :
15 12 if $#_ == -1
2646 12 0 exists $self->{'order'} ? :
12 0 if $#_ == 0
2693 7 0 if $#_ <= 0
2699 8 12 $self->{'pnames'}{$_[0]} ? :
2703 8 12 $self->{'pnames'}{$_[0]} ? :
2707 22 0 exists $self->{'pnames'} ? :
2713 4 0 if $class->check_params
2723 2 2 if $class->parents
2724 2 2 $p % 2 == 0 ? :
2769 5 0 if defined $_[0]
2775 9 0 defined $self->{'super_values'} ? :
2787 3 1 if (@sv = $self->super_values)