Branch Coverage

blib/lib/Rose/HTML/Form.pm
Criterion Covered Total %
branch 325 494 65.7


line true false branch
142 4 157 if (@_)
144 0 4 $_[0] ? :
155 4 153 defined $self->{'trim_xy_params'} ? :
162 0 11 if ref $class
164 8 3 if (@_)
169 0 8 if $value =~ /\d/ and $value == 1
171 0 8 unless (not $value or $value eq "compile" or $value eq "runtime")
194 89 1 if $self->build_on_init
209 2 42 if (@_) { }
215 2 40 unless (defined $self->html_attr("name"))
228 0 0 if (@_)
235 0 0 $_[0] ? :
247 0 0 $_[0]->is_repeatable_form || $_[0]->is_repeatable_field ? :
257 65 107 unless $field->is_empty
262 0 11 unless $form->is_empty
272 8 87 if (@_)
283 77 10 unless $ok
287 0 2 unless $form->empty_is_ok
300 0 3 unless @_ > 1
302 0 3 unless (UNIVERSAL::isa($cgi, "CGI") or UNIVERSAL::can($cgi, "param"))
315 3 4 @values > 1 ? :
325 0 8 exists $ENV{'MOD_PERL_API_VERSION'} && $ENV{'MOD_PERL_API_VERSION'} > 1 ? :
329 1 7 ($ENV{'MOD_PERL'} || $ENV{'RHTMLO_TEST_MOD_PERL'}) && (!exists $ENV{'MOD_PERL_API_VERSION'} || $ENV{'MOD_PERL_API_VERSION'} == 1) ? :
332 0 8 $ENV{'MOD_PERL'} ? :
341 0 2 unless @_ > 1
345 0 2 unless (UNIVERSAL::can($apr, "param"))
394 2 3 @values > 1 ? :
404 157 34 if (@_)
406 140 17 if (@_ == 1 and ref $_[0] eq 'HASH') { }
17 0 elsif (@_ % 2 == 0) { }
419 153 4 if ($self->trim_xy_params)
423 1 703 if ($param =~ /^(.+)\.[xy]$/)
438 157 34 unless defined $want
440 1 33 $want ? :
452 0 0 keys %{$_[0]{'params'};} ? :
458 8 28 if UNIVERSAL::isa($name, "Rose::HTML::Form::Field")
460 2 34 unless $self->field($name)
467 11 51 if ($self->form($nibble) and not $self->field($nibble))
473 11 40 if $self->param_exists($nibble)
474 12 28 unless $nibble =~ s/\.[^.]+$//
477 11 12 $found_form ? :
480 20 3 if ($field->can("subfield_names"))
485 19 83 unless index($name, $subname) == 0 or index($subname, $name) == 0
488 10 73 if $self->param_exists($subname)
500 0 3 unless @_ == 3
505 0 3 unless $param
507 3 0 ref $param ? :
509 2 7 if $existing_value eq $value
519 249 1 if (@_ == 2) { }
1 0 elsif (@_ == 3) { }
521 246 3 if (exists $self->{'params'}{$param})
523 214 32 if (wantarray)
525 9 205 if (ref $self->{'params'}{$param})
550 0 4 unless @_ >= 2
553 1 3 if @values == 1 and ref $values[0] eq "ARRAY"
555 3 1 if (@values) { }
561 2 1 if (ref $current) { }
1 0 elsif (exists $values{$self->{'params'}{$param}}) { }
567 4 3 unless exists $values{$val}
570 2 0 if (@new) { }
572 1 1 @new > 1 ? :
594 0 1 unless @_ == 3
599 1 0 if (ref $current) { }
0 0 elsif (defined $current) { }
601 0 1 ref $value ? :
605 0 0 ref $value ? :
609 0 0 ref $value ? :
623 0 1 if (keys %{$$self{"params"};})
625 0 0 unless $self_uri =~ /\?$/
647 9 10 unless ($coalesce)
649 1 8 if ($field->isa("Rose::HTML::Form::Field::Compound"))
657 2 16 unless defined $value
658 6 10 ref $value ? :
670 13 3 if $qs
681 23 32 unless exists $args{'cascade'}
687 51 4 if ($cascade)
691 2 30 if $form->is_empty and $form->empty_is_ok
693 0 30 if $Debug
695 5 25 unless ($form->validate(%args))
697 4 1 if $form->error
703 52 3 unless ($args{'form_only'})
705 2 50 if $self->is_empty and $self->empty_is_ok
709 136 118 if ($field->parent_form ne $self) { }
711 0 136 if $Debug
715 0 118 if $Debug
716 10 108 unless $field->validate
721 13 40 if ($fail)
723 9 4 unless ($self->has_errors)
754 114 2 unless $args{'no_clear'}
756 0 116 exists $args{'recursive'} ? :
56 60 if (exists $args{'recursive'} ? $args{'recursive'} : $self->recursive_init_fields) { }
787 0 501 if $Debug
793 48 453 if (not $name_exists and $field->isa('Rose::HTML::Form::Field::Compound')) { }
802 239 1 unless $name_exists or $name_attr_exists or $moniker_exists or $on_off
804 41 173 if ($field->isa('Rose::HTML::Form::Field::Group')) { }
806 41 0 if ($name_exists) { }
0 0 elsif ($moniker_exists) { }
808 0 41 if $Debug
813 0 0 if $Debug
818 0 0 if $Debug
825 0 173 if ($on_off) { }
828 0 0 if ($name_exists and $self->param($name) eq $field->html_attr('value')) { }
830 0 0 if $Debug
835 0 0 if ($self->params_exist) { }
848 172 1 if ($name_exists) { }
1 0 elsif ($moniker_exists) { }
850 0 172 if $Debug
855 0 1 if $Debug
860 0 0 if $Debug
884 0 0 if $self->param_exists_for_field($field->name)
919 16 3 if (@_ == 1) { }
3 0 elsif (@_) { }
923 2 14 if (ref $class)
944 0 19 if ($object->isa('Rose::DB::Object')) { }
957 0 0 if (defined(my $form_name_context = $self->form_name_context))
962 0 0 if ($check_name ne $name)
966 0 0 if $self->field($check_name)
970 0 0 if ($object->can($name))
973 0 0 if ($field->isa('Rose::HTML::Form::Field::Checkbox') and $meta->column($name) and $meta->column($name)->type eq 'boolean') { }
998 18 108 if (defined(my $form_name_context = $self->form_name_context))
1003 63 63 if ($check_name ne $name)
1007 3 123 if $self->field($check_name)
1011 69 54 if ($object->can($name))
1028 0 4 unless $object
1036 5 10 if ($object->can($name))
1070 44 0 if $form->rank >= $rank
1090 1 7 if (@_ > 1)
1097 0 7 unless my $form = $self->form(@_)
1098 0 7 unless $form->is_repeatable
1106 0 0 if (@_)
1110 0 0 unless defined wantarray
1115 0 0 wantarray ? :
1128 0 6 if (UNIVERSAL::isa($arg, 'Rose::HTML::Form')) { }
6 0 elsif (not ref $arg) { }
1139 4 2 if (UNIVERSAL::isa($_[0], 'Rose::HTML::Form')) { }
2 0 elsif (ref $_[0] eq 'HASH') { }
1153 2 0 unless exists $spec->{'repeatable'}
1176 72 8194 if (@_)
1181 8083 111 if defined $self->{'form_depth'}
1204 1 73 if (UNIVERSAL::isa($arg, 'Rose::HTML::Form')) { }
1208 1 0 if (&Scalar::Util::refaddr($form) eq &Scalar::Util::refaddr($self))
1215 0 0 unless defined $name
1216 0 0 if $self->field($name)
1219 0 0 unless (defined $form->rank)
1230 0 73 if $self->field($name)
1233 59 14 if (UNIVERSAL::isa($form, 'Rose::HTML::Form')) { }
14 0 elsif (ref $form eq 'HASH') { }
1235 1 58 if (&Scalar::Util::refaddr($form) eq &Scalar::Util::refaddr($self))
1241 3 55 if $self->empty_is_ok
1245 0 14 unless (exists $form->{'repeatable'})
1252 1 13 if (ref $form->{'repeatable'}) { }
1259 8 5 unless exists $repeat_spec->{'default_count'}
1265 0 14 if $repeat_spec->{'spec'}
1268 3 11 if $repeat_spec->{'form_spec'}
1271 0 14 if $repeat_spec->{'class'}
1274 4 10 if $repeat_spec->{'form_class'}
1277 8 6 if $repeat_spec->{'form'}
1282 1 13 if ($repeat_spec->{'empty_is_ok'} or $self->empty_is_ok)
1294 37 35 unless (defined $form->rank)
1301 2 70 if (index($name, '.') >= 0) { }
1321 42 30 if ($form->recursive_init_fields or $form->isa("Rose::HTML::Form::Repeatable"))
1333 66 0 unless defined wantarray
1377 0 1670 if (@_)
1381 0 0 unless defined wantarray
1384 1490 180 if (my $forms = $self->{'form_list'})
1386 1453 37 wantarray ? :
1393 180 0 wantarray ? :
1400 2 180 if (my $names = $self->{'form_names'})
1402 0 2 wantarray ? :
1415 180 0 wantarray ? :
1436 0 4 if UNIVERSAL::isa($name, "Rose::HTML::Form")
1438 4 0 if (exists $self->{'forms'}{$name} and $self->{'forms'}{$name}->is_repeatable_form)
1468 0 0 if UNIVERSAL::isa($name, "Rose::HTML::Form")
1470 0 0 if (exists $self->{'forms'}{$name} and $self->{'forms'}{$name}->is_repeatable_field)
1498 0 15 if UNIVERSAL::isa($name, "Rose::HTML::Form")
1500 14 1 if (exists $self->{'forms'}{$name})
1545 8250 77 unless @_
1550 6 71 if (my $parent_form = $self->parent_form)
1552 2 4 if (defined $old_name and defined $name and $name ne $old_name)
1566 257 1351 if (my $field = shift())
1572 34 223 unless length $field->name
1584 0 113 unless $self->{'fields'}
1602 0 2 if UNIVERSAL::isa($name, "Rose::HTML::Form::Field")
1615 629 2455 if $self->{'field_cache'}{$name}
1620 1557 898 if (($sep_pos = index($name, ".")) < 0)
1630 17 881 if (UNIVERSAL::isa($field, "Rose::HTML::Form::Field::Compound"))
1633 17 0 if $field
1638 0 881 unless $parent_form
1647 2 926 if (@_)
1653 682 246 if (my $fields = $self->{'field_list'})
1655 680 2 wantarray ? :
1666 610 995 if (/$FF_SEPARATOR_RE([^$FF_SEPARATOR_RE]+)/o) { }
1668 0 0 unless $self->field($_) or $fields->{$1}
1672 4 0 unless $fields->{$_} or $fields_by_name->{$_}
1678 246 0 wantarray ? :
1692 52 0 wantarray ? :
1699 25 242 if (my $names = $self->{'field_monikers'})
1701 22 3 wantarray ? :
1709 0 625 unless $self->compare_forms($Rose::HTML::Form::a->[0], $Rose::HTML::Form::b->[0])
1711 242 0 wantarray ? :
1736 277 964 if (index($name, ".") < 0)
1738 0 277 $self->local_form($name) ? :
1746 913 422 if $parent_form = $self->local_form($parent_name)
1749 51 913 unless (defined $parent_form)
1752 30 21 if $self->local_field($name)
1756 913 0 wantarray ? :
1764 0 2 if (index($name, ".") < 0)
1766 0 0 wantarray ? :
1774 2 0 if $parent_form = $self->form($1)
1777 2 0 wantarray ? :
1784 4083 2167 unless $self->parent_form
1795 2167 0 @parts ? :
1802 108 18 unless $self->parent_form
1809 18 27 unless $form->parent_form
1820 1113 1059 if exists $self->{'forms'}{$name}
1829 1 560 if (@_)
1837 200 360 if (my $form = $self->local_form($name))
1844 298 62 unless defined $parent_form
1852 5 0 delete $args{'_xhtml'} ? :
1857 0 5 exists $args{'max_button_depth'} ? :
1859 0 5 defined $args{'class'} ? :
1867 5 0 defined $args{'class'} ? :
0 5 defined $args{'table'}{'class'} ? :
1869 0 5 defined $args{'tr'}{'class'} ? :
1877 2 3 if $html
1890 0 10 if ($field->is_button)
1892 0 0 if $field->field_depth > $max_button_depth
1894 0 0 if ($field->field_depth == 1)
1901 0 10 if ($field->isa("Rose::HTML::Form::Field::File"))
1906 5 5 $i++ % 2 ? :
1909 0 10 $args{'td'}{'class'} ? :
1913 10 0 unless ($label)
1925 0 10 if ($field->html_attr_exists("id"))
1933 0 10 if ($field->is_button) { }
1946 0 10 $args{'td'}{'class'} ? :
1954 0 5 if (@buttons)
1956 0 0 $i++ % 2 ? :
1959 0 0 $args{'td'}{'class'} ? :
1971 2 3 unless $html =~ /\n\n\z/
1982 0 0 if @_
1989 0 0 if @_
1999 0 3 unless my $class = ref $self
2003 0 3 unless ($delegate)
2015 2 1 if ($form->can($method))
2022 1 2 unless ($to_form)
2028 2 0 if ($delegate eq 'compile') { }
0 0 elsif ($delegate eq 'runtime') { }