Condition Coverage

blib/lib/CGI/Ex/Validate.pm
Criterion Covered Total %
condition 128 310 41.2


and 3 conditions

line !l l&&!r l&&r condition
31 0 0 221 $form and ref $form
37 211 4 4 $ARGS->{'validate_if'} and not $self->check_conditional($form, $ARGS->{'validate_if'})
50 237 0 0 not ref $ref and $ref eq "OR"
65 15 0 0 $not and $_key =~ /(?$opt:$pat)/
91 101 3 0 $i < $#$fields and not ref $$fields[$i + 1]
104 0 0 $i < $#$fields and not ref $$fields[$i + 1] and $$fields[$i + 1] eq "OR"
247 0 0 0 $not and $_field =~ /(?$opt:$pat)/
254 263 1 7 $field_val->{'was_valid'} and not $self->{'was_valid'}{$field}
255 261 0 3 $field_val->{'had_error'} and not $self->{'had_error'}{$field}
256 261 0 0 $field_val->{'was_checked'} and not $self->{'was_checked'}{$field}
260 260 1 0 defined $field_val->{'default'} and !defined($form->{$field}) || (UNIVERSAL::isa($form->{$field}, 'ARRAY') ? !@{$form->{$field};} : !length($form->{$field}))
324 256 0 5 $modified and $n_values == 1
335 8 237 16 not $needs_val and $n_vif
351 190 26 29 $is_required and $n_values == 0 || $n_values == 1 && !(defined $values->[0] && length $values->[0])
381 18 1 23 defined $_value and length $_value
384 7 4 3 $minmax eq "min" and $n > 0
4 4 3 $minmax eq "max" and $n < 0
401 6 17 7 defined $value and $_ eq $value
428 0 1 1 defined $value && $value eq $test
431 2 0 5 exists $form->{$field2} and defined $form->{$field2}
432 1 2 2 defined $value && $value eq $form->{$field2}
455 5 11 1 defined $value and length $value > $n
468 0 2 4 defined $value and $value =~ /$rx/
478 1 1 1 defined $value and $value =~ /(?$opt:$pat)/
12 2 1 $not and (defined $value and $value =~ /(?$opt:$pat)/)
540 0 0 0 not $return and $$field_val{"${type}_error_if"}
0 0 0 $return and not $$field_val{"${type}_error_if"}
556 0 1 1 not ref $@ and defined $err
569 204 0 2 $field_val->{'untaint'} and $#errors == -1
601 0 0 0 defined $value and length $value
622 0 0 0 $value and not $self->check_type($value, "uri")
679 0 0 0 $form and $ARGS->{'validate_if'}
0 0 0 $form and $ARGS->{'validate_if'} and not $self->check_conditional($form, $ARGS->{'validate_if'})
687 2 0 0 $ENV{'HTTP_USER_AGENT'} and grep {$ENV{'HTTP_USER_AGENT'} =~ /$_/;} @UNSUPPORTED_BROWSERS
948 124 0 2 defined $custom_err and length $custom_err
960 0 98 26 not $name and $field =~ /\W/ || $field =~ /\d/ && $field =~ /\D/

or 2 conditions

line l !l condition
56 237 0 $ref->{'field'} || die('Missing field key during normal validation')
177 219 1 $fields || []
218 34 0 $ref->{'field'} || die('Missing field key during validate_if (possibly used a reference to a main hash *foo -> &foo)')
232 26 245 $self->{'_recurse'} || 0
357 5 0 $field_val->{'min_values'} || 0
364 214 0 $field_val->{'max_values'} || 0
372 14 407 $_->[1] || (next)
496 12 3 $value || 0
534 0 0 &$dbh($field, $self) || die('SQL Coderef did not return a dbh')
680 0 0 $_->{'name'} || 1
730 0 0 $args->{'div'} ||= "
\n"
731 0 0 $args->{'open'} ||= "
\n"
733 0 0 $args->{'action'} ||= ""
734 0 0 $args->{'method'} ||= "POST"
735 0 0 $args->{'submit_name'} || 'Submit'
736 0 0 $args->{'header'} ||= "\n" \n
738 0 0 $args->{'footer'} ||= "
\$submit
\n"
739 0 0 $args->{'extra_form_attrs'} ||= ""
774 0 0 $field->{'enum'} || []
785 0 0 $field->{'enum'} || []
810 0 0 $args->{'close'} || "\n"
0 0 $args->{'div_close'} || "\n"
836 119 0 $self->{'extra'} || {}
837 0 119 shift() || {}
853 119 0 $self->{'errors'} || die('Missing errors')
854 119 0 $self->{'extra'} || {}
855 119 0 shift() || {}
900 6 0 $self->{'errors'} || die('Missing errors')
901 6 0 $self->{'extra'} || {}
902 4 2 shift() || {}
946 126 0 $self->{'extra'} || {}
974 0 224 $field_val->{$key} || $extra->{$key} || (next)

or 3 conditions

\n \n \n" : "\n \n") . " \n"
line l !l&&r !l&&!r condition
23 0 2 0 +(shift())->{'cgix'} ||= do { require CGI::Ex; "CGI::Ex"->new }
65 0 9 6 $not || $_key =~ /(?$opt:$pat)/
0 6 9 $not and $_key =~ /(?$opt:$pat)/ or not $not || $_key =~ /(?$opt:$pat)/
105 8 0 207 $ARGS->{'no_extra_fields'} or $self->{'no_extra_fields'}
130 0 0 0 ref $val_hash ne "SCALAR" or not ref $val_hash
141 0 1 219 $ARGS{'fields'} || $ARGS{'order'}
189 32 2 0 not ref $ifs or UNIVERSAL::isa($ifs, "HASH")
247 0 0 0 $not || $_field =~ /(?$opt:$pat)/
0 0 0 $not and $_field =~ /(?$opt:$pat)/ or not $not || $_field =~ /(?$opt:$pat)/
260 1 0 0 !defined($form->{$field}) || (UNIVERSAL::isa($form->{$field}, 'ARRAY') ? !@{$form->{$field};} : !length($form->{$field}))
310 0 0 3 $2 > $#$start || $2 == 0
351 0 29 26 $n_values == 0 || $n_values == 1 && !(defined $values->[0] && length $values->[0])
384 3 3 8 $minmax eq "min" and $n > 0 or $minmax eq "max" and $n < 0
447 1 2 1 not defined $value or length $value < $n
478 2 7 5 $not || defined $value && $value =~ /(?$opt:$pat)/
1 5 9 $not and (defined $value and $value =~ /(?$opt:$pat)/) or not $not || defined $value && $value =~ /(?$opt:$pat)/
540 0 0 0 not $return and $$field_val{"${type}_error_if"} or $return and not $$field_val{"${type}_error_if"}
596 0 0 0 $self->check_type($dom, "domain") or $self->check_type($dom, "ip")
612 0 0 8 not $value or length $value > 255
613 3 1 4 not $value =~ /^([a-z0-9][a-z0-9\-]{0,62} \.)+ [a-z]{1,63}$/xi or $value =~ /(\.\-|\-\.|\.\.)/
621 0 0 0 $self->check_type($dom, "domain") or $self->check_type($dom, "ip")
642 0 0 0 length $value > 16 or length $value < 13
690 2 0 0 shift() || croak('Missing validation hash')
692 0 0 0 ref $val_hash ne "SCALAR" or not ref $val_hash
704 0 0 0 $args->{'form_name'} || croak('Missing form_name')
2 0 0 $form_name ||= $args->{'form_name'} || croak('Missing form_name')
705 2 0 0 $js_uri_path ||= $args->{'js_uri_path'}
707 0 2 0 $JS_URI_PATH_VALIDATE || do { croak('Missing js_uri_path') unless $js_uri_path; "$js_uri_path/CGI/Ex/validate.js" }
729 0 0 0 $args->{'no_inline_error'} || !$args->{'columns'} || $args->{'columns'} != 3
732 0 0 0 $form_name || 'the_form_' . int(rand *1000)
0 0 0 $args->{'form_name'} ||= $form_name || 'the_form_' . int(rand *1000)
735 0 0 0 $args->{'submit'} ||= "{'submit_name'} || 'Submit') . "\">"
744 0 0 0 $args->{'row_template'} ||= "
\$name\$input" . ($cols == 2 ? $args->{'no_inline_error'} ? "" : "
[% \$field_error %]
[% \$field_error %]
748 0 0 0 !defined($args->{'use_js_validation'}) || $args->{'use_js_validation'}
765 0 0 0 $type eq "textarea" or $field->{'rows'}
0 0 0 $type eq "textarea" or $field->{'rows'} or $field->{'cols'}
0 0 0 $type eq "radio" or $type eq "checkbox"
0 0 0 $type eq "select" or $field->{'enum'}
0 0 0 $type eq "select" or $field->{'enum'} or $field->{'label'}
775 0 0 0 $field->{'label'} || $e
786 0 0 0 $field->{'label'} || $e
795 0 0 0 $field->{'maxlength'} || $field->{'max_len'}
802 0 0 0 $field->{'name'} || do { $name =~ tr/_/ /; $name =~ s/\b(\w)/\u$1/g; $name }
960 0 26 98 $field =~ /\W/ || $field =~ /\d/ && $field =~ /\D/
986 18 1 93 $type eq "required" or $type eq "required_if"
1004 0 5 0 $$field_val{"equals${dig}_name"} || "the field $field2"