Branch Coverage

lib/CGI/FormBuilder.pm
Criterion Covered Total %
branch 262 440 59.5


line true false branch
105 3 132 if (@_ == 1) { }
107 3 0 UNIVERSAL::isa($_[0], 'HASH') ? :
114 23 112 if (my $src = delete $opt{'source'})
120 0 23 unless ($ref)
122 0 0 $opt{'c'} && $opt{'c'}->action ? :
134 23 0 if ($ref eq 'HASH') { }
0 0 elsif ($ref eq 'CODE') { }
0 0 elsif (UNIVERSAL::can($$src{'source'}, 'parse')) { }
0 0 elsif ($ref) { }
139 23 0 unless $mod =~ /::/
143 0 23 if $@
159 135 0 unless exists $opt{$k}
163 1 134 if (ref $self) { }
173 278 5618 if exists $opt{$k}
174 922 4696 if (ref $v eq 'HASH') { }
0 4696 elsif (ref $v eq 'ARRAY') { }
186 131 4 unless (ref $$self{'params'})
198 2 133 if (lc $$self{'messages'} eq 'auto') { }
201 2 0 if (UNIVERSAL::isa($$self{'params'}, 'CGI')) { }
0 0 elsif (UNIVERSAL::isa($$self{'params'}, 'Apache')) { }
0 0 elsif (UNIVERSAL::isa($$self{'params'}, 'Catalyst::Request')) { }
220 109 26 if ($$self{'fields'})
225 4 105 if ($ref and $ref eq 'HASH') { }
241 0 135 if (UNIVERSAL::isa($$self{'validate'}, 'Data::FormValidator')) { }
247 8 127 if (ref $$self{'required'}) { }
8 119 elsif ($$self{'required'}) { }
28 91 elsif ($$self{'validate'}) { }
251 1 7 if ($$self{'required'} eq 'NONE') { }
6 1 elsif ($$self{'required'} eq 'ALL') { }
1 0 elsif ($$self{'required'}) { }
271 258 46 unless $$self{'fieldopts'}{$_}
273 0 304 if (ref $_ =~ /^CGI::FormBuilder::Field/i) { }
291 48 87 if $$self{'values'}
313 1 1095 if ref $_[0] eq 'ARRAY' and @_ == 1
316 1058 37 @_ % 2 == 0 ? :
321 953 142 unless ($$args{'name'})
325 952 1 if (wantarray) { }
328 0 0 if $redo->order eq 'auto'
331 0 0 if ($$self{'fields'}[$i] eq $redo)
338 0 0 if ($redo->order <= 1) { }
0 0 elsif ($redo->order >= @{$$self{'fields'};}) { }
363 0 142 if ($$args{'delete'}) { }
92 50 elsif (my $f = $$self{'fieldrefs'}{$$args{'name'}}) { }
375 8 42 unless keys %$args > 1
391 0 346 unless exists $$args{'name'}
396 2749 1749 unless exists $$self{$from}
397 4 1745 if defined $$args{$to}
403 12 334 if $$self{'fieldtype'} and not exists $$args{'type'}
405 11 335 if ($$self{'fieldattr'})
407 0 11 if exists $$args{$k}
420 0 258 if (@_)
421 0 0 if (ref $_[0] eq 'ARRAY') { }
0 0 elsif (@_ % 2) { }
429 0 0 if ($k eq $$_[0])
435 0 0 if ($k)
450 0 270 if exists $legends{$o}
458 704 44 unless my $o = $_->fieldset
459 40 4 if exists $legends{$o}
464 129 129 wantarray ? :
469 0 59 @_ ? :
474 19 194 if $saw{$_}
475 11 183 if ($_->fieldset and $_->fieldset eq $set)
489 162 11 unless $saw{$_}
492 59 0 wantarray ? :
497 0 123 if @_
498 94 29 unless $$self{'header'}
500 3 26 if ($$self{'cookies'} and defined(my $sid = $self->sessionid))
510 28 1 if $main::TESTING
517 1 31 if @_
523 0 3 if @_
529 0 15 if @_
530 14 1 if $main::TESTING
540 0 127 if @_
541 121 6 if exists $$self{'title'}
549 0 9 if @_
550 1 8 if exists $$self{'action'}
556 0 339 if @_
557 337 2 unless $$self{'font'}
558 2 0 if $$self{'stylesheet'}
563 0 0 if (not $ref) { }
0 0 elsif ($ref eq 'ARRAY') { }
572 0 0 wantarray ? :
583 2 127 $self->disabled ? :
587 0 129 unless $$self{'_didscript'}
591 0 129 if $attr{'onSubmit'}
604 0 690 if @_
605 5 685 $$self{'disabled'} ? :
610 0 14 if @_
611 7 7 unless $$self{'stylesheet'}
617 1183 307 unless $$self{'stylesheet'}
623 577 175 unless defined $$self{'id'}
625 568 184 unless $$self{'id'}
633 0 106 if @_ == 1
634 2 104 unless $$self{'table'}
637 1 103 if $$self{'table'} == 1
640 100 4 if (@_)
649 0 104 unless $$self{'table'}
658 0 218 if @_ == 1 and UNIVERSAL::isa($_[0], 'HASH')
661 218 0 if (@_)
671 50 168 if ($$self{'stylesheet'}) { }
685 0 0 if @_ == 1 and UNIVERSAL::isa($_[0], 'HASH')
688 0 0 if (@_)
698 0 0 if ($$self{'stylesheet'}) { }
712 0 383 if @_ == 1 and UNIVERSAL::isa($_[0], 'HASH')
715 383 0 if (@_)
734 0 90 if @_ == 1 and UNIVERSAL::isa($_[0], 'HASH')
737 90 0 if (@_)
752 2 11 $$self{'name'} ? :
754 11 2 if ($$self{'params'}->param($smtag))
786 1 158 if @_
787 6 153 if $$self{'sessionid'}
788 0 153 unless $$self{'sessionidname'}
790 153 0 if ($$self{'cookies'})
794 0 153 if (my $cook = $cookies{"$$self{'sessionidname'}"}) { }
807 18 111 $$self{'name'} ? :
812 2 127 if (defined(my $sid = $self->sessionid))
818 2 127 if (defined $$self{'page'})
823 0 129 wantarray ? :
834 0 129 if @_
835 119 10 unless $$self{'keepextras'}
840 4 6 if ($ref eq 'ARRAY') { }
0 6 elsif ($ref) { }
848 18 32 if $p =~ /^_/ or $$self{'fieldrefs'}{$p}
854 0 10 if wantarray
868 1 164 if @_
871 150 15 if (lc $$self{'javascript'} eq 'auto')
872 0 150 if (exists $ENV{'HTTP_USER_AGENT'} and $ENV{'HTTP_USER_AGENT'} =~ /lynx|mosaic/i)
880 15 0 if exists $$self{'javascript'}
892 18 114 $$self{'name'} ? :
906 12 120 unless $self->javascript
918 120 0 unless (UNIVERSAL::isa($$self{'validate'}, 'Data::FormValidator'))
925 82 5 unless $jsfunc or $jsmisc or $jshead
928 33 5 if ($jsfunc)
941 0 33 if (my $jse = $self->jserror) { }
958 0 33 if (my $jss = $self->jsvalid) { }
982 118 2 unless my(@growable) = grep({$_->growable;} $self->field)
1028 0 2 if $count > 0
1031 0 2 if ($limit and $limit ne 1)
1040 115 5 unless my(@otherable) = grep({$_->other;} $self->field)
1065 0 15 if @_
1066 0 15 unless $self->javascript
1080 17 106 if (ref $$self{'submit'} eq 'ARRAY') { }
1082 17 0 $self->javascript ? :
1086 23 17 $i > 1 ? :
1096 86 20 $$self{'submit'} eq 1 ? :
1104 122 1 wantarray ? :
1109 0 128 if @_
1110 6 122 if not $$self{'submit'} or $self->static or $self->disabled
1119 0 129 if @_
1120 0 5 if not $$self{'reset'} or $self->static or $self->disabled
1124 1 4 $$self{'reset'} eq 1 ? :
1136 0 59 if @_
1142 35 138 if $_->required
1143 2 171 if $_->invalid
1146 56 3 unless ($self->static or $self->disabled)
1148 2 54 if $inv
1152 13 41 if $req
1161 9 10 $$self{'stylesheet'} ? :
1164 2 17 wantarray ? :
1170 16 32 $$self{'stylesheet'} ? :
1173 13 35 wantarray ? :
1183 4 70 if (my $key = shift()) { }
1184 4 0 @_ ? :
1189 70 0 wantarray ? :
1196 129 0 if $main::TESTING
1197 0 0 if (ref $_[0]) { }
1207 49 0 if (@_)
1219 0 49 if (UNIVERSAL::isa($$self{'values'}, 'CODE')) { }
47 2 elsif (UNIVERSAL::isa($$self{'values'}, 'HASH')) { }
2 0 elsif (UNIVERSAL::isa($$self{'values'}, 'ARRAY')) { }
1246 89 29 if defined $v
1254 0 60 @_ ? :
1259 0 0 if (@_)
1270 0 0 if (@_)
1281 0 0 if (@_)
1292 0 0 if (@_)
1305 0 0 if defined $v
1313 0 0 if (@_)
1326 0 0 if defined $v
1336 0 19 if (@_)
1337 0 0 if (ref $_[0]) { }
0 0 elsif (@_ % 2 == 0) { }
0 0 elsif (@_ > 1) { }
1352 0 19 if (UNIVERSAL::isa($$self{'validate'}, 'Data::FormValidator')) { }
1370 0 0 if @invalid_fields > 0
1374 6 35 unless $_->validate
1384 0 0 $main::TESTING ? :
1455 0 70 wantarray ? :
1464 1 69 if (@_)
1465 0 1 unless @_ % 2 == 0
1476 0 70 if (not $ref and $$self{'template'})
1491 12 58 if ($ref eq 'HASH') { }
0 58 elsif ($ref eq 'CODE') { }
0 58 elsif (UNIVERSAL::can($$self{'template'}, 'render')) { }
0 58 elsif ($ref) { }
1509 70 0 unless $mod =~ /::/
1514 7 63 if $@
1531 59 4 if ($tmpl and UNIVERSAL::can($tmpl, 'prepare'))
1555 0 0 unless ($mailer = $$args{'mailer'} && -x $mailer)
1557 0 0 if (-x $sendmail)
1563 0 0 unless ($mailer)
1567 0 0 unless ($$args{'to'})
1571 0 0 if ($$args{'from'})
1582 0 0 unless open MAIL, "|$mailer >/dev/null 2>&1"
1585 0 0 if $$args{'cc'}
1586 0 0 if $self->charset
1604 0 0 unless @_ > 1
1608 0 0 unless $$args{'to'} ||= $to
1625 0 0 if (exists $$args{'plugin'})
1628 0 0 if $@
1633 0 0 if $@
1646 0 0 if ($$args{'skip'})
1647 0 0 if ($$args{'skip'} =~ /^m?(\S)(.*)\1$/)
1655 0 0 if ($$args{'skip'} and $field =~ /$$args{'skip'}/)
1659 0 0 if $$args{'labels'}
1677 0 3229 if ($$self{'fieldsubs'} and $$self{'fieldrefs'}{$name})
1682 5 3224 if (@_ % 2 == 1)
1685 2 3 if ($REARRANGE{$name})
1695 0 3229 if (!exists($$self{$name}) || @_ and not $CGI::FormBuilder::Util::OURATTR{$name})
1696 0 0 if ($$self{'fieldsubs'}) { }