Branch Coverage

lib/CGI/FormBuilder/Field.pm
Criterion Covered Total %
branch 184 266 69.1


line true false branch
108 0 346 unless @_ > 1
115 0 346 unless $opt->{'name'}
131 152 29 if (ref $_[0] or @_ > 1)
134 0 215 if $k eq 'name'
144 0 1245 if @_
151 0 2349 if @_
152 2254 95 unless $self->{'other'}
153 6 89 unless ref $self->{'other'}
155 0 95 wantarray ? :
165 0 7 unless $self->other
174 1 6 if ($self->sticky and defined $v)
178 4 3 if $self->javascript and not defined $v
190 0 1222 if @_
191 1222 0 $self->{'_form'}{'params'}->can('multi_param') ? :
173 1049 if (my(@v) = $self->{'_form'}{'params'}->can('multi_param') ? $self->{'_form'}{'params'}->multi_param($self->name) : $self->{'_form'}{'params'}->param($self->name))
193 6 173 if ($self->other and $v eq $self->othername)
200 173 0 wantarray ? :
208 0 1181 if (@_)
216 999 182 wantarray ? :
225 1246 2 unless exists $self->{'inflate'}
229 0 2 if grep {(caller $_)[3] eq 'CGI::FormBuilder::Field::validate';} (1, 2)
235 0 2 if $self->invalid
240 1 1 if ($cache and ref $cache eq 'ARRAY' and @{$cache;}) { }
250 0 1 if ref $self->{'inflate'} ne 'CODE'
255 0 1 if $@
270 0 277 if (@_)
274 265 12 unless ($self->force)
277 67 198 if (my(@v) = $self->cgi_value)
281 18 49 wantarray ? :
293 0 1041 if (@_)
298 0 1041 if $self->{'tag_value'}
300 957 84 if ($self->sticky and not $self->force)
303 106 851 if (my(@v) = $self->cgi_value)
306 106 0 wantarray ? :
317 0 0 if @_
318 0 0 if $self->{'tag_name'}
321 0 0 unless $tag
329 0 1334 if (@_)
341 36 1298 if ($self->static and $self->{'type'} ne 'hidden')
354 1100 234 if $self->{'_cache'}{'type'}
358 166 68 unless ($type = lc $self->{'type'})
365 166 0 if ($self->{'_form'}->smartness)
367 51 115 if (my $n = $self->options) { }
0 115 elsif ($self->{'_form'}->smartness > 1) { }
369 15 36 if ($n >= $self->selectnum) { }
378 8 28 if ($self->multiple or @v > 1 or $n == 1) { }
390 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) { }
413 0 234 if $@
421 0 778 if @_
422 86 692 if defined $self->{'label'}
428 0 383 if (my $k = shift()) { }
429 0 0 if @_
430 0 0 exists $self->{$k} ? :
436 874 4208 if $k =~ /^_/ or $k eq 'validate'
437 18 4190 if ($k eq 'jsclick') { }
3134 1056 elsif (exists $self->{$k}) { }
444 162 2972 if $k eq 'type'
448 767 3441 unless defined $v
457 8 375 $self->disabled ? :
462 232 151 $ret{'type'} eq 'text' ? :
467 0 383 wantarray ? :
473 0 460 if (@_)
477 3 457 if $self->{'multiple'}
479 44 413 if @v > 1
485 0 760 if (@_)
489 522 238 unless $self->{'options'}
495 67 171 unless wantarray
498 18 153 if $self->sortopts
506 0 4 if @_
508 4 0 unless ($mess)
510 0 4 $type eq 'text' ? :
511 0 4 if $self->other
516 4 0 $self->{'_form'}{'stylesheet'} ? :
522 0 400 if @_
524 400 0 unless ($mess)
526 275 125 $type eq 'text' ? :
527 7 393 if $self->other
537 0 383 if @_
540 12 25 $self->{'_form'}{'stylesheet'} ? :
547 2 199 $self->invalid ? :
553 5 13 $type eq 'radio' || $type eq 'checkbox' ? :
575 246 77 unless $self->javascript and $pattern || $self->required
579 0 77 unless ($jsfunc)
587 0 77 if (ref $pattern eq 'Regexp')
593 0 77 if (ref $pattern eq 'HASH')
598 33 44 if $VALIDATE{$pattern}
610 71 6 $self->required ? :
614 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) { }
633 0 0 if $pattern =~ /^[A-Z]+$/
669 0 41 exists $self->{'inflate'} ? :
670 0 41 if defined $inflate and ref $inflate ne 'CODE'
672 0 41 if defined $inflate and not defined $pattern
674 0 41 if $inflate
679 14 27 if $VALIDATE{$pattern}
682 2 39 if (ref $pattern eq 'HASH')
696 48 12 if ($self->required) { }
700 10 2 unless length $value and defined $pattern
707 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) { }
712 3 15 unless ($value =~ /$tpat/)
718 5 3 unless (&ismember($value, @{$pattern;}))
725 0 10 unless (&{$pattern;}($value, $extra))
731 0 1 unless (defined $value and length $value)
736 2 7 unless length $value > 0
739 0 4 if $pattern =~ /^[A-Z]+$/
743 0 4 unless (eval "\$value $pattern ? 1 : 0")
746 0 4 if $@
750 10 40 $thisfail ? :
754 0 50 if (defined $inflate)
757 0 0 if ($@)
765 0 0 $thisfail ? :
772 6 35 if ($bad or not $atleastone and $self->required) { }
787 0 1551 if @_
788 8 1543 if exists $self->{'static'}
795 0 383 if @_
797 8 0 $self->{'disabled'} ? :
8 375 if exists $self->{'disabled'}
804 0 688 if @_
805 0 688 if exists $self->{'javascript'}
812 0 1541 if @_
813 1515 26 unless $self->{'growable'}
815 0 26 unless ($self->type eq 'text' or $self->type eq 'file')
824 0 9645 if @_
826 0 9645 unless exists $self->{'name'}
838 0 10351 unless ref $self
840 6 10345 if @_