Branch Coverage

lib/CGI/FormBuilder.pm
Criterion Covered Total %
branch 262 442 59.2


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)
127 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}
404 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 ? :
588 0 129 unless $self->{'_didscript'}
592 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'}
624 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
858 40 0 $self->{'params'}->can('multi_param') ? :
869 1 164 if @_
872 150 15 if (lc $self->{'javascript'} eq 'auto')
873 0 150 if (exists $ENV{'HTTP_USER_AGENT'} and $ENV{'HTTP_USER_AGENT'} =~ /lynx|mosaic/i)
881 15 0 if exists $self->{'javascript'}
895 18 114 $self->{'name'} ? :
907 12 120 unless $self->javascript
919 120 0 unless (UNIVERSAL::isa($self->{'validate'}, 'Data::FormValidator'))
926 82 5 unless $jsfunc or $jsmisc or $jshead
929 33 5 if ($jsfunc)
942 0 33 if (my $jse = $self->jserror) { }
959 0 33 if (my $jss = $self->jsvalid) { }
983 118 2 unless my(@growable) = grep({$_->growable;} $self->field)
1029 0 2 if $count > 0
1032 0 2 if ($limit and $limit ne 1)
1041 115 5 unless my(@otherable) = grep({$_->other;} $self->field)
1066 0 15 if @_
1067 0 15 unless $self->javascript
1081 17 106 if (ref $self->{'submit'} eq 'ARRAY') { }
1083 17 0 $self->javascript ? :
1087 23 17 $i > 1 ? :
1098 86 20 $self->{'submit'} eq 1 ? :
1105 122 1 wantarray ? :
1110 0 128 if @_
1111 6 122 if not $self->{'submit'} or $self->static or $self->disabled
1120 0 129 if @_
1121 0 5 if not $self->{'reset'} or $self->static or $self->disabled
1126 1 4 $self->{'reset'} eq 1 ? :
1137 0 59 if @_
1143 35 138 if $_->required
1144 2 171 if $_->invalid
1147 56 3 unless ($self->static or $self->disabled)
1150 2 54 if $inv
1154 13 41 if $req
1163 9 10 $self->{'stylesheet'} ? :
1165 2 17 wantarray ? :
1172 16 32 $self->{'stylesheet'} ? :
1174 13 35 wantarray ? :
1184 4 70 if (my $key = shift()) { }
1186 4 0 @_ ? :
1190 70 0 wantarray ? :
1197 129 0 if $main::TESTING
1198 0 0 if (ref $_[0]) { }
1208 49 0 if (@_)
1220 0 49 if (UNIVERSAL::isa($self->{'values'}, 'CODE')) { }
47 2 elsif (UNIVERSAL::isa($self->{'values'}, 'HASH')) { }
2 0 elsif (UNIVERSAL::isa($self->{'values'}, 'ARRAY')) { }
1247 89 29 if defined $v
1255 0 60 @_ ? :
1260 0 0 if (@_)
1271 0 0 if (@_)
1282 0 0 if (@_)
1293 0 0 if (@_)
1306 0 0 if defined $v
1314 0 0 if (@_)
1327 0 0 if defined $v
1337 0 19 if (@_)
1338 0 0 if (ref $_[0]) { }
0 0 elsif (@_ % 2 == 0) { }
0 0 elsif (@_ > 1) { }
1353 0 19 if (UNIVERSAL::isa($self->{'validate'}, 'Data::FormValidator')) { }
1371 0 0 if @invalid_fields > 0
1375 6 35 unless $_->validate
1385 0 0 $main::TESTING ? :
1456 0 70 wantarray ? :
1465 1 69 if (@_)
1466 0 1 unless @_ % 2 == 0
1477 0 58 if (not $ref and $self->{'template'})
1492 12 58 if ($ref eq 'HASH') { }
0 58 elsif ($ref eq 'CODE') { }
0 58 elsif (UNIVERSAL::can($self->{'template'}, 'render')) { }
0 58 elsif ($ref) { }
1510 70 0 unless $mod =~ /::/
1515 7 63 if $@
1532 59 4 if ($tmpl and UNIVERSAL::can($tmpl, 'prepare'))
1556 0 0 unless ($mailer = $args->{'mailer'} && -x $mailer)
1558 0 0 if (-x $sendmail)
1564 0 0 unless ($mailer)
1568 0 0 unless ($args->{'to'})
1572 0 0 if ($args->{'from'})
1583 0 0 unless open MAIL, "|$mailer >/dev/null 2>&1"
1586 0 0 if $args->{'cc'}
1587 0 0 if $self->charset
1605 0 0 unless @_ > 1
1609 0 0 unless $args->{'to'} ||= $to
1626 0 0 if (exists $args->{'plugin'})
1629 0 0 if $@
1634 0 0 if $@
1647 0 0 if ($args->{'skip'})
1648 0 0 if ($args->{'skip'} =~ /^m?(\S)(.*)\1$/)
1656 0 0 if ($args->{'skip'} and $field =~ /$args->{'skip'}/)
1660 0 0 if $args->{'labels'}
1678 0 0 if ($self->{'fieldsubs'} and $self->{'fieldrefs'}{$name})
1683 5 3224 if (@_ % 2 == 1)
1686 2 3 if ($REARRANGE{$name})
1696 0 3229 if (!exists $self->{$name} || @_ and not $CGI::FormBuilder::Util::OURATTR{$name})
1697 0 0 if ($self->{'fieldsubs'}) { }