Branch Coverage

blib/lib/HTML/Form.pm
Criterion Covered Total %
branch 278 346 80.3


line true false branch
46 22 11 if @_ == 1
50 3 30 ref $html ? :
51 0 33 unless $p
58 0 33 if ($^W)
62 3 30 unless (defined $base_uri)
63 3 0 if (ref $html) { }
70 33 0 unless (defined $charset)
71 2 31 if (ref $html and $html->can("content_charset"))
74 32 1 unless ($charset)
86 37 22 if ($tag eq 'form') { }
0 22 elsif ($form_tags{$tag}) { }
88 25 12 unless defined $action
93 1 36 if $attr->{'accept-charset'}
96 5 32 if $strict
102 36 168 if $tag eq "/form"
104 165 3 if ($tag ne "textarea")
107 13 152 if (defined $current_label)
109 26 0 if defined $_
115 66 102 if ($tag eq "input")
118 5 60 defined $current_label ? :
1 65 exists $attr->{'id'} && exists $labels{$attr->{'id'}} ? :
122 7 161 if ($tag eq 'label') { }
7 154 elsif ($tag eq '/label') { }
66 88 elsif ($tag eq 'input') { }
2 86 elsif ($tag eq 'button') { }
3 83 elsif ($tag eq 'textarea') { }
25 58 elsif ($tag eq 'select') { }
1 57 elsif ($tag eq 'keygen') { }
125 1 6 if exists $attr->{'for'}
140 0 3 if exists $attr->{'value'}
149 1 49 if exists $attr->{$_}
153 2 23 unless defined $name
158 21 93 if $tag eq "/select"
159 0 93 if $tag =~ m[/?optgroup]
160 21 72 if $tag eq "/option"
161 67 5 if ($tag eq 'option') { }
165 31 21 if $_ eq "value"
173 36 31 unless defined $a{'value'}
178 0 5 if $verbose
179 0 1 if ($tag eq "/form" or $tag eq "input" or $tag eq "textarea" or $tag eq "select" or $tag eq "keygen")
190 2 2 $tag =~ s[^/][] ? :
203 0 0 if $verbose
210 5 28 wantarray ? :
231 1 149 unless ($class)
232 1 0 if $verbose
237 7 143 if $type eq "hidden"
238 43 107 if $self->{'strict'}
239 2 11 if ($type eq "file" and exists $attr->{'value'})
258 7 78 if @_
269 0 2 unless defined $name
272 0 2 if @_
280 6 0 if (@_)
302 2 171 if defined $no and $no < 1
304 3 168 if (wantarray) { }
305 1 2 if defined $no
310 3 4 if defined $name and not $_->selected($name)
311 0 4 if $type and $type ne $_->{'type'}
313 0 4 if $no and $no != $c
322 418 169 if defined $name and not $_->selected($name)
323 11 158 if $type and $type ne $_->{'type'}
324 19 139 if --$no
346 0 41 unless ($input)
347 0 0 if $self->{'strict'}
348 0 0 unless @_
358 30 2 if (@_) { }
363 135 51 if not defined $n or $n ne $name
367 8 22 if (@_) { }
369 0 8 unless @inputs
371 3 5 if @v == 1 and ref $v[0]
379 7 9 unless ($@)
386 2 7 if $err
398 22 13 if (defined(my $v = $_->value))
402 15 7 wantarray ? :
411 6 8 if not defined $n or $seen{$n}++
426 0 0 unless @not_tried_yet
429 0 0 unless @try
439 0 0 if $i + 1 < @$try
453 37 4 $self->accept_charset eq 'UNKNOWN' ? :
455 126 12 unless ref $fi
458 20 21 if ($method eq 'GET') { }
21 0 elsif ($method eq 'POST') { }
480 0 30 if @_ % 2 == 1
484 48 7 unless $_->can("click")
485 0 7 if $name and not $_->selected($name)
486 1 6 if $_->disabled
489 0 24 if $name
510 0 2 if $enctype ne "application/x-www-form-urlencoded"
513 1 1 if exists $self->{'attr'}{'name'}
518 0 2 unless defined wantarray
544 8 2 if (@_)
564 1 233 if @_
572 0 1 if @_
580 0 1 if @_
586 0 579 unless defined $sel
587 14 539 $sel =~ s/^\.// ? :
20 553 $sel =~ s/^#// ? :
6 573 $sel =~ s/^\^// ? :
592 4 575 unless defined $self->{$attr}
600 1 10 if @_
608 2 4 if @_
633 1 5 if @_
641 1 59 if @_
650 4 64 unless defined $name
651 3 61 if $self->disabled
653 5 56 unless defined $value
661 0 1 unless defined $name
663 0 1 unless defined $value
668 0 1 if $self->disabled
669 0 1 if $self->readonly
670 1 0 unless $self->{'menu'}
676 0 0 unless defined $opt
678 0 0 if defined $_->{'name'} and length $_->{'name'} and $_->{'name'} ne $opt
679 0 0 if $_->{'disabled'}
680 0 0 if (exists $self->{'current'} and $self->{'current'} == $i) { }
681 0 0 unless $_->{'seen'}
685 0 0 if $_->{'seen'}
708 36 80 unless defined $old
709 24 92 if (@_)
711 2 4 if $self->{'strict'} and $self->{'readonly'}
713 4 18 exists $self->{'maxlength'} ? :
715 1 1 if $self->{'strict'} and defined $n and defined $new and length $new > $n
749 7 82 if ($type eq 'checkbox') { }
750 2 5 unless defined $value
755 5 2 delete $self->{'checked'} ? :
760 4 11 if $type eq "radio" and delete $self->{'disabled'}
767 16 66 if (exists $self->{'multiple'}) { }
769 2 14 $checked ? :
772 9 57 if $checked
783 7 82 if $type eq "checkbox"
786 16 51 if ($type eq "option" and exists $self->{'multiple'})
791 0 66 if @{$self->{'menu'};} != 1
793 9 57 if delete $self->{'option_disabled'}
796 28 38 unless $prev
799 4 34 if exists $self->{'current'}
806 11 40 if ($self->{'type'} eq "option" and not exists $self->{'current'})
809 43 8 if exists $self->{'current'}
818 5 37 if (@_)
830 28 6 unless $_->{'disabled'}
839 88 4 if exists $self->{'current'}
840 0 92 if exists $self->{'value'}
841 41 51 if (@_)
847 27 52 if (defined $val and defined $_->{'value'} and $val eq $_->{'value'} or not defined $val || defined $_->{'value'})
853 20 7 unless $disabled
857 21 20 if (not defined $cur or $disabled)
858 20 1 if (defined $val) { }
1 0 elsif ($self->{'strict'}) { }
864 35 8 if (defined $_->{'name'})
865 4 31 if ($val eq $_->{'name'})
868 3 1 unless $disabled
870 3 29 if (not defined $cur_ignorecase and $lc_val eq lc $_->{'name'})
876 10 10 unless (defined $cur)
878 2 8 if (defined $cur) { }
8 0 elsif ($self->{'strict'}) { }
892 7 25 if ($self->{'strict'} and $disabled)
896 25 0 if (defined $cur) { }
934 1 9 unless defined $n
952 12 0 unless defined $_
954 3 3 unless defined $self->value
961 3 4 unless $self->{'clicked'}
974 0 2 unless $clicked
975 0 2 if $self->{'disabled'}
977 1 1 defined $name && length $name ? :
997 3 13 if @_
998 13 3 unless defined $old
1006 2 13 if @_
1014 0 13 if @_
1020 1 13 if $form->method ne "POST" or $form->enctype ne "multipart/form-data"
1025 0 13 unless defined $name
1026 0 13 if $self->{'disabled'}
1033 2 11 if (defined $content or grep /^Content$/i, keys %headers) { }
1 10 elsif (not defined $file or length $file == 0) { }
1034 0 2 unless defined $filename
1043 7 5 if (ref $file eq "ARRAY")