Branch Coverage

blib/lib/HTML/Form.pm
Criterion Covered Total %
branch 154 190 81.0


line true false branch
55 23 12 if @_ == 1
59 3 32 ref $html ? :
61 0 35 unless $p
68 1 34 if ($^W)
73 3 32 unless (defined $base_uri)
74 3 0 if (ref $html) { }
81 35 0 unless (defined $charset)
82 2 33 if (ref $html and $html->can("content_charset"))
85 34 1 unless ($charset)
97 38 22 if ($tag eq 'form') { }
0 22 elsif ($form_tags{$tag}) { }
99 25 13 unless defined $action
107 1 37 if $attr->{'accept-charset'}
110 5 33 if $strict
116 36 172 if $tag eq "/form"
118 169 3 if ($tag ne "textarea")
122 13 156 if (defined $current_label)
124 26 0 if defined $_
129 66 106 if ($tag eq "input")
133 5 60 defined $current_label ? :
1 65 exists $attr->{'id'} && exists $labels{$attr->{'id'}} ? :
137 7 165 if ($tag eq 'label') { }
7 158 elsif ($tag eq '/label') { }
66 92 elsif ($tag eq 'input') { }
2 90 elsif ($tag eq 'button') { }
3 87 elsif ($tag eq 'textarea') { }
29 58 elsif ($tag eq 'select') { }
1 57 elsif ($tag eq 'keygen') { }
140 1 6 if exists $attr->{'for'}
155 0 3 if exists $attr->{'value'}
165 1 57 if exists $attr->{$_}
170 4 25 unless defined $name
175 25 101 if $tag eq "/select"
176 0 101 if $tag =~ m[/?optgroup]
177 25 76 if $tag eq "/option"
178 71 5 if ($tag eq 'option') { }
183 31 25 if $_ eq "value"
191 40 31 unless defined $a{'value'}
196 0 5 if $verbose
198 0 1 if ($tag eq "/form" or $tag eq "input" or $tag eq "textarea" or $tag eq "select" or $tag eq "keygen")
209 2 2 $tag =~ s[^/][] ? :
222 0 0 if $verbose
229 5 30 wantarray ? :
248 1 153 unless ($class)
249 1 0 if $verbose
254 7 147 if $type eq "hidden"
255 43 111 if $self->{'strict'}
256 2 11 if ($type eq "file" and exists $attr->{'value'})
274 7 79 if @_
284 0 2 unless defined $name
287 0 2 if @_
294 6 0 if (@_)
310 2 177 if defined $no and $no < 1
312 4 173 if (wantarray) { }
313 1 3 if defined $no
318 9 2 if (defined $selector)
321 4 5 if (ref $selector eq 'SCALAR') { }
323 1 3 if not defined $$selector and $_->{'name'}
329 3 2 unless $_->selected($selector)
332 0 7 if $type and $type ne $_->{'type'}
334 0 7 if $no and $no != $c
343 594 0 if (defined $selector)
346 19 575 if (ref $selector eq 'SCALAR') { }
348 5 14 if not defined $$selector and $_->{'name'}
354 419 156 unless $_->selected($selector)
357 8 162 if $type and $type ne $_->{'type'}
358 22 140 if --$no
376 0 41 unless ($input)
377 0 0 if $self->{'strict'}
378 0 0 unless @_
387 30 2 if (@_) { }
392 135 51 if not defined $n or $n ne $name
396 8 22 if (@_) { }
399 0 8 unless @inputs
401 3 5 if @v == 1 and ref $v[0]
407 7 9 unless ($@)
414 2 7 if $err
426 22 13 if (defined(my $v = $_->value))
430 15 7 wantarray ? :
439 6 8 if not defined $n or $seen{$n}++
451 0 0 unless @not_tried_yet
454 0 0 unless @try
463 0 0 if $i + 1 < @$try
477 38 4 $self->accept_charset eq 'UNKNOWN' ? :
479 130 12 unless ref $fi
482 21 21 if ($method eq 'GET') { }
21 0 elsif ($method eq 'POST') { }
503 0 31 if @_ % 2 == 1
507 52 7 unless $_->can("click")
508 0 7 if $name and not $_->selected($name)
509 1 6 if $_->disabled
512 0 25 if $name
527 0 2 if $enctype ne "application/x-www-form-urlencoded"
530 1 1 if exists $self->{'attr'}{'name'}
536 0 2 unless defined wantarray