Branch Coverage

lib/CGI/FormBuilder/Field.pm
Criterion Covered Total %
branch 183 264 69.3


line true false branch
109 0 346 unless @_ > 1
115 0 346 unless $$opt{'name'}
132 152 29 if (ref $_[0] or @_ > 1)
135 0 215 if $k eq 'name'
145 0 1245 if @_
152 0 2349 if @_
153 2254 95 unless $$self{'other'}
154 6 89 unless ref $$self{'other'}
156 0 95 wantarray ? :
166 0 7 unless $self->other
175 1 6 if ($self->sticky and defined $v)
179 4 3 if $self->javascript and not defined $v
191 0 1222 if @_
192 173 1049 if (my(@v) = $$self{'_form'}{'params'}->param($self->name))
194 6 173 if ($self->other and $v eq $self->othername)
201 173 0 wantarray ? :
209 0 1181 if (@_)
217 999 182 wantarray ? :
226 1246 2 unless exists $$self{'inflate'}
230 0 2 if grep {(caller $_)[3] eq 'CGI::FormBuilder::Field::validate';} (1, 2)
236 0 2 if $self->invalid
241 1 1 if ($cache and ref $cache eq 'ARRAY' and @{$cache;}) { }
250 0 1 if ref $$self{'inflate'} ne 'CODE'
256 0 1 if $@
271 0 277 if (@_)
275 265 12 unless ($self->force)
278 67 198 if (my(@v) = $self->cgi_value)
282 18 49 wantarray ? :
294 0 1041 if (@_)
299 0 1041 if $$self{'tag_value'}
301 957 84 if ($self->sticky and not $self->force)
304 106 851 if (my(@v) = $self->cgi_value)
307 106 0 wantarray ? :
318 0 0 if @_
319 0 0 if $$self{'tag_name'}
322 0 0 unless $tag
330 0 1334 if (@_)
342 36 1298 if ($self->static and $$self{'type'} ne 'hidden')
355 1100 234 if $$self{'_cache'}{'type'}
359 166 68 unless ($type = lc $$self{'type'})
366 166 0 if ($$self{'_form'}->smartness)
368 51 115 if (my $n = $self->options) { }
0 115 elsif ($$self{'_form'}->smartness > 1) { }
370 15 36 if ($n >= $self->selectnum) { }
379 8 28 if ($self->multiple or @v > 1 or $n == 1) { }
391 0 0 if ($name =~ /passw(or)?d/i) { }
0 0 elsif ($name =~ /(?:details?|comments?)$/i or grep /\n|\r/, @v || $self->cols || $self->rows) { }
0 0 elsif ($name =~ /\bfile/i) { }
414 0 234 if $@
422 0 778 if @_
423 86 692 if defined $$self{'label'}
429 0 383 if (my $k = shift()) { }
430 0 0 if @_
431 0 0 exists $$self{$k} ? :
437 874 4208 if $k =~ /^_/ or $k eq 'validate'
438 18 4190 if ($k eq 'jsclick') { }
3134 1056 elsif (exists $$self{$k}) { }
445 162 2972 if $k eq 'type'
449 767 3441 unless defined $v
457 8 375 $self->disabled ? :
461 232 151 $ret{'type'} eq 'text' ? :
468 0 383 wantarray ? :
474 0 460 if (@_)
478 3 457 if $$self{'multiple'}
480 44 413 if @v > 1
486 0 760 if (@_)
490 522 238 unless $$self{'options'}
496 67 171 unless wantarray
499 18 153 if $self->sortopts
507 0 4 if @_
509 4 0 unless ($mess)
511 0 4 $type eq 'text' ? :
512 0 4 if $self->other
516 4 0 $$self{'_form'}{'stylesheet'} ? :
523 0 400 if @_
525 400 0 unless ($mess)
527 275 125 $type eq 'text' ? :
528 7 393 if $self->other
538 0 383 if @_
540 12 25 $$self{'_form'}{'stylesheet'} ? :
548 2 199 $self->invalid ? :
554 5 13 $type eq 'radio' || $type eq 'checkbox' ? :
576 246 77 unless $self->javascript and $pattern || $self->required
580 0 77 unless ($jsfunc)
588 0 77 if (ref $pattern eq 'Regexp')
594 0 77 if (ref $pattern eq 'HASH')
599 33 44 if $VALIDATE{$pattern}
611 71 6 $self->required ? :
615 39 38 if ($pattern =~ /^m?(\S)(.*)\1$/) { }
2 36 elsif (ref $pattern eq 'ARRAY') { }
36 0 elsif (ref $pattern eq 'CODE' or $pattern eq 'VALUE' or $self->required and not $pattern) { }
634 0 0 if $pattern =~ /^[A-Z]+$/
670 0 41 exists $$self{'inflate'} ? :
671 0 41 if defined $inflate and ref $inflate ne 'CODE'
673 0 41 if defined $inflate and not defined $pattern
675 0 41 if $inflate
680 14 27 if $VALIDATE{$pattern}
683 2 39 if (ref $pattern eq 'HASH')
697 48 12 if ($self->required) { }
701 10 2 unless length $value and defined $pattern
708 18 32 if ($pattern =~ /^m(\S)(.*)\1$/ or $pattern =~ m[^(/)(.*)\1$]) { }
8 24 elsif (ref $pattern eq 'ARRAY') { }
10 14 elsif (ref $pattern eq 'CODE') { }
1 13 elsif ($pattern eq 'VALUE') { }
9 4 elsif (not defined $pattern) { }
713 3 15 unless ($value =~ /$tpat/)
719 5 3 unless (ismember $value, @{$pattern;})
726 0 10 unless (&{$pattern;}($value, $extra))
732 0 1 unless (defined $value and length $value)
737 2 7 unless length $value > 0
740 0 4 if $pattern =~ /^[A-Z]+$/
744 0 4 unless (eval "\$value $pattern ? 1 : 0")
747 0 4 if $@
751 10 40 $thisfail ? :
755 0 50 if (defined $inflate)
758 0 0 if ($@)
766 0 0 $thisfail ? :
773 6 35 if ($bad or not $atleastone and $self->required) { }
788 0 1551 if @_
789 8 1543 if exists $$self{'static'}
796 0 383 if @_
797 8 0 $$self{'disabled'} ? :
8 375 if exists $$self{'disabled'}
805 0 688 if @_
806 0 688 if exists $$self{'javascript'}
813 0 1541 if @_
814 1515 26 unless $$self{'growable'}
816 0 26 unless ($self->type eq 'text' or $self->type eq 'file')
825 0 9659 if @_
826 0 9659 unless exists $$self{'name'}
839 0 10351 unless ref $self
841 6 10345 if @_