Branch Coverage

blib/lib/HTML/Formulate.pm
Criterion Covered Total %
branch 216 264 81.8


line true false branch
84 119 0 wantarray ? :
90 117 0 wantarray ? :
97 0 25 wantarray ? :
110 0 25 if $$defn{'form'} and not ref $$defn{'form'}
133 24 1 unless $$defn{'formtype'} and $$defn{'formtype'} eq 'table'
168 1 456 if (/^input_/) { }
361 95 elsif ($TEXT_ATTR{$_} or $TEXTAREA_ATTR{$_} or $SELECT_ATTR{$_}) { }
176 20 341 if ($type eq 'select') { }
3 338 elsif ($type eq 'textarea') { }
266 72 elsif (not $type or $type eq 'text' or $type eq 'password') { }
177 11 9 if $SELECT_ATTR{$_}
181 3 0 if $TEXTAREA_ATTR{$_}
187 266 0 if $TEXT_ATTR{$_}
191 37 35 if $INPUT_ATTR{$_}
208 7 81 if ($$defn_t{'formtype'} eq 'table')
214 80 1 if (ref $$defn_t{'hidden'} eq 'HASH') { }
1 0 elsif (ref $$defn_t{'hidden'} eq 'ARRAY') { }
219 4 1 unless grep /^$hidden$/, @{$$defn_t{'fields'};}
227 3 1 unless grep /^$hidden$/, @{$$defn_t{'fields'};}
234 7 74 if ($required and not ref $required and $required =~ /^(ALL|NONE)$/) { }
1 140 elsif ($required and not ref $required) { }
235 1 6 if ($required eq 'NONE') { }
6 0 elsif ($$defn_t{'fields'} and ref $$defn_t{'fields'} eq 'ARRAY') { }
245 14 67 if ($required and ref $required eq 'ARRAY')
253 57 24 if exists $$defn_t{'fields'} and not exists $$defn_t{'submit'}
258 12 69 if ($$self{'defn_t'}{'errors'})
260 11 0 if $$self{'defn_t'}{'errors'}{$_} ne ''
263 0 12 if $error_messages and not $$self{'defn_t'}{'errors_where'} =~ /^(column|top)$/
267 70 11 unless $error_messages
292 31 42 if ($$self{'defn_t'}{'use_name_as_id'} and $tag =~ qr/^(input|select|textarea)$/ and exists $$attr{'name'})
308 529 478 if $row
311 45 484 if (not defined $row or $$self{'defn_t'}{'formtype'} eq 'table' or $$fattr{'composite'})
316 478 45 unless defined $row
317 523 0 wantarray ? :
322 0 484 if defined $$self{'defn_t'}{'null'} and $value eq $$self{'defn_t'}{'null'}
324 78 406 if defined $value and $value eq ''
328 478 6 $$self{'defn_t'}{'xhtml'} ? :
329 0 484 if defined $$self{'defn_t'}{'null'} and defined $$fattr{'value'} and $$fattr{'value'} eq $$self{'defn_t'}{'null'}
332 106 378 if ($$fattr{'type'} eq 'static' or $$fattr{'type'} eq 'display') { }
22 356 elsif ($$fattr{'type'} eq 'select') { }
14 342 elsif ($$fattr{'type'} eq 'radio') { }
0 342 elsif ($$fattr{'type'} eq 'hidden') { }
2 340 elsif ($$fattr{'type'} eq 'textarea') { }
333 2 104 if ($$fattr{'vlabel'}) { }
334 1 1 if (ref $$fattr{'vlabel'}) { }
335 1 0 if (ref $$fattr{'vlabel'} eq 'CODE')
347 96 10 if $$fattr{'type'} eq 'static'
355 8 14 if (ref $values eq 'CODE')
357 4 4 @values == 1 && ref $values[0] ? :
359 22 0 if (ref $values eq 'ARRAY' and @$values)
367 120 0 if defined $v
368 20 100 if (defined $value)
370 0 20 if (ref $value eq 'ARRAY') { }
371 0 0 if grep {$v eq $_;} @$value
373 4 16 if $v eq $value
378 16 104 if (ref $vlabels eq 'CODE')
384 14 2 @vlabels == 1 ? :
386 6 10 if (ref $vlabel)
391 36 84 if (ref $vlabels eq 'HASH') { }
74 10 elsif (ref $vlabels eq 'ARRAY') { }
397 12 108 unless defined $vlabel
409 10 4 if (ref $values eq 'CODE')
411 6 4 @values == 1 && ref $values[0] ? :
413 14 0 if (ref $values eq 'ARRAY' and @$values)
422 66 0 if defined $v
423 0 66 if (defined $value)
425 0 0 if (ref $value eq 'ARRAY') { }
426 0 0 if grep {$v eq $_;} @$value
428 0 0 if $v eq $value
432 10 56 $$self{'defn_t'}{'use_name_as_id'} ? :
66 0 defined $v ? :
0 66 defined $value && !ref($value) && defined $v && $v eq $value ? :
440 18 48 if (ref $vlabels eq 'CODE')
446 16 2 @vlabels == 1 ? :
448 8 10 if (ref $vlabel)
453 28 38 if (ref $vlabels eq 'HASH') { }
28 10 elsif (ref $vlabels eq 'ARRAY') { }
459 0 66 if not defined $vlabel or $vlabel eq ''
503 2 4 if $$fattr{'type'} and $$fattr{'type'} ne 'display'
514 45 496 if $$self{'defn_t'}{'formtype'} eq 'table'
519 496 0 unless $type and $type eq 'hidden'
534 4 393 if (ref $$self{'defn_t'}{'field_attr'}{-'submit'} eq 'HASH' and exists $$self{'defn_t'}{'field_attr'}{-'submit'}{'table'})
542 11 365 if $$self{'defn_t'}{'field_attr'}{-'select'} and ref $$self{'defn_t'}{'field_attr'}{-'select'} eq 'HASH' and $$self{'defn_t'}{'field_attr'}{$field}{'type'} and $$self{'defn_t'}{'field_attr'}{$field}{'type'} eq 'select'
550 95 281 if $$self{'defn_t'}{'field_attr'}{-'submit'} and ref $$self{'defn_t'}{'field_attr'}{-'submit'} eq 'HASH' and $$self{'defn_t'}{'submit_hash'}{$field}
557 34 363 if $$self{'defn_t'}{'field_attr'}{-'required'} and $$self{'defn_t'}{'field_attr'}{$field}{'required'}
563 22 375 if $$self{'defn_t'}{'field_attr'}{-'errors'} and exists $$self{'defn_t'}{'errors'}{$field}
579 3 338 if ($$td_attr{'tr'} and ref $$td_attr{'tr'} eq 'HASH')
583 56 285 if ($$td_attr{'th'} and ref $$td_attr{'th'} eq 'HASH')
587 3 338 if ($$td_attr{'td'} and ref $$td_attr{'td'} eq 'HASH')
593 24 317 if ($$td_attr{'td_error'} and ref $$td_attr{'td_error'} eq 'HASH')
596 10 14 if $$self{'defn_t'}{'errors_where'} eq 'column'
610 0 281 if $$self{'defn_t'}{'formtype'} eq 'table'
623 34 247 if ($type eq 'hidden') { }
5 242 elsif ($type eq 'omit') { }
626 29 5 unless defined $value
630 3 31 if $$self{'defn_t'}{'hidden'}{$field} eq $$self{'defn_t'}{'null'}
645 239 3 if ($$self{'defn_t'}{'labels'})
651 242 0 if ($th_colspan < 2)
656 15 227 if ($$self{'defn_t'}{'errors_where'} eq 'column')
660 2 13 ref $$self{'defn_t'}{'errors'}{$field} eq 'ARRAY' ? :
680 0 77 unless $fields and ref $fields eq 'ARRAY' and @$fields
689 78 0 if (ref $$self{'defn_t'}{'hidden'} eq 'HASH')
709 7 80 unless $$defn{'submit'}
712 0 0 $$defn{'submit'} == 1 ? :
0 80 unless ref $$defn{'submit'}
725 78 21 unless ($$defn{'submit_attr'})
745 75 5 if ($arg{'table'}) { }
747 5 70 if $$defn{'errors_where'} and $$defn{'errors_where'} eq 'column'
748 1 74 unless $$self{'defn_t'}{'labels'}
749 74 1 $cols > 1 ? :
770 0 6 unless $$defn_t{'errors_format'}
777 12 12 if ($errors{$field})
778 2 10 if (ref $errors{$field} eq 'ARRAY') { }
791 0 0 if (ref $errors{$extra} eq 'ARRAY') { }
798 0 6 unless @errors
801 5 1 if (ref $$defn_t{'errors_format'}) { }
808 0 2 unless substr($out, -1) eq "\n"
820 88 0 if $$self{'defn_t'}{'title'}
821 6 82 if $$self{'defn_t'}{'errors_where'} and $$self{'defn_t'}{'errors_where'} eq 'top'
824 88 0 if $$self{'defn_t'}{'text'}
835 78 7 if $$self{'defn_t'}{'form'}
838 81 4 if ($submit_location eq 'bottom') { }
2 2 elsif (exists $$self{'defn_t'}{'submit_table'} and $$self{'defn_t'}{'submit_table'} == 0) { }
861 2 83 if ($submit_location eq 'top') { }
3 80 elsif (exists $$self{'defn_t'}{'submit_table'} and $$self{'defn_t'}{'submit_table'} == 0) { }
873 78 7 if $$self{'defn_t'}{'hidden'}
874 78 7 if $$self{'defn_t'}{'form'}
883 7 81 if $$self{'defn_t'}{'formtype'} eq 'table'
893 7 81 if $$self{'defn_t'}{'formtype'} eq 'table'
903 78 3 if $do_form
908 78 3 if ($do_form)
926 0 90 if (ref $self eq 'HASH' or ref $self eq 'ARRAY')