Branch Coverage

blib/lib/Config/Validator.pm
Criterion Covered Total %
branch 204 302 67.5


line true false branch
118 17 0 defined $scalar ? :
130 240 330 unless @errors
133 297 0 ref $error ? :
134 240 57 unless length $tmp
149 7 3 if ($value =~ /^(\d+(ms|s|m|h|d))+$/) { }
167 7 3 if ($value =~ /^(.+?)([kmgt]?b)$/i) { }
181 4 343 unless defined $value
188 1 4 unless defined $value
199 1 4 unless defined $thing
200 3 1 if ref $thing eq "ARRAY"
219 3 0 if ($kv =~ /^([^\=]+)=(.*)$/) { }
225 3 0 if wantarray
237 4 1 if (@args == 1 and ref $args[0] eq 'HASH') { }
257 3 0 if ($key =~ /^(\w+)-(.+)$/) { }
264 2 5 if ref $value eq "HASH"
276 8 4 if exists $hash->{$name}
277 4 0 if ($name =~ /^(\w+)-(.+)$/)
278 0 4 unless $hash->{$1}
298 39 19 if $data =~ /^[a-z46]+$/
299 0 19 if $data =~ /^(ref|isa)\(\*\)$/
300 3 16 if $data =~ /^(ref|isa)\([\w\:]+\)$/
301 7 9 if ($data =~ /^(list\??|table)\((.+)\)$/)
304 9 0 if ($data =~ /^valid\((.+)\)$/)
305 8 1 if $Config::Validator::_Known->{$1}
363 1 49 if defined $data->{$field} and not $data->{'type'} =~ /^(string|number|integer|list.*|table.*)$/
366 0 49 if defined $data->{$field} and not $data->{'type'} =~ /^(string|number|integer|list.*|table.*)$/
369 0 49 if defined $data->{$field} and not $data->{'type'} =~ /^(string|table.*)$/
371 1 48 if ($data->{'type'} =~ /^(list|table)$/) { }
372 0 1 unless defined $data->{$field}
374 0 48 if defined $data->{$field}
377 3 46 if ($data->{'type'} =~ /^(struct)$/) { }
378 0 3 unless defined $data->{$field}
380 0 46 if defined $data->{$field}
427 0 0 if $type eq "string"
428 0 0 if $type eq "number"
429 0 0 if $type eq "integer"
430 0 0 if $type eq "boolean"
432 0 0 if $type =~ /^isa\(.+\)$/ or $type eq "table(string)" or $type =~ /^(duration|hostname|ipv[46]|regexp|size)$/
437 0 0 if ($type =~ /^list\?\((.+)\)$/)
440 0 0 if ($type =~ /^valid\((.+)\)$/)
441 0 0 unless $valid->{$1}
444 0 0 if ($type eq "struct")
464 0 0 unless defined &treeval($hash, $opt)
466 0 0 if @list == 2
477 0 0 unless not defined $opt1 or defined &treeval($hash, $opt1)
479 0 0 if defined &treeval($hash, $opt2)
480 0 0 if defined $opt1
493 0 0 unless not defined $opt1 or defined &treeval($hash, $opt1)
495 0 0 if defined &treeval($hash, $opt2)
497 0 0 if (@options <= 2) { }
503 0 0 if defined $opt1
520 0 1 unless $reftype eq "ARRAY"
530 0 1 unless $reftype eq "HASH"
540 0 2 unless $reftype eq "HASH"
542 0 6 unless exists $data->{$key}
556 0 18 unless &$callback($valid, $schema, $type, $_[4], @path)
558 6 12 if $type =~ /^(boolean|number|integer)$/
559 0 12 if $type =~ /^(duration|size|hostname|ipv[46])$/
560 0 12 if $type =~ /^(undef|undefined|defined|blessed|unblessed)$/
561 0 12 if $type =~ /^(anything|string|regexp|object|reference|code)$/
564 8 4 if ($type =~ /^valid\((.+)\)$/)
565 0 8 unless $valid->{$1}
569 2 2 if ($type eq "struct")
574 0 2 if ($type =~ /^list$/)
579 1 1 if ($type =~ /^list\((.+)\)$/)
584 0 1 if ($type =~ /^list\?\((.+)\)$/)
585 0 0 if ($reftype eq 'ARRAY') { }
594 0 1 if ($type =~ /^table$/)
599 1 0 if ($type =~ /^table\((.+)\)$/)
632 7 37 if defined $min and not $value >= $min
634 7 30 if defined $max and not $value <= $max
649 10 3 if defined $schema->{'min'} or defined $schema->{'max'}
650 4 9 if @errors
655 3 9 if @errors
674 6 38 if defined $schema->{'min'} or defined $schema->{'max'}
675 1 43 if @errors
680 1 56 if defined $schema->{'match'} and not $key =~ /$schema->{'match'}/
681 1 56 if @errors
683 5 51 if @errors
702 89 342 if exists $data->{$key}
703 339 3 if &is_true($schema->{'fields'}{$key}{'optional'})
710 1 87 unless $schema->{'fields'}{$key}
712 3 84 if @errors
732 53 12 unless @tmperrors
748 67 351 if ($type eq 'string') { }
257 94 elsif ($type =~ /^(boolean|hostname|ipv[46])$/) { }
94 0 elsif ($type =~ /^(integer|number|duration|size)$/) { }
751 7 60 if defined $schema->{'min'} or defined $schema->{'max'}
755 3 60 if not @errors and defined $schema->{'match'} and not $data =~ /$schema->{'match'}/x
757 121 136 unless $data =~ /$_RE{$type}/
759 13 123 if ($type eq "hostname")
760 3 10 if ".$data." =~ /\.\d+\./
764 26 68 unless $data =~ /$_RE{$type}/
767 11 57 if defined $schema->{'min'} or defined $schema->{'max'}
771 256 12 unless @errors
786 7 157 if ($schema->{'type'} =~ /^(blessed|object|isa\(\*\))$/) { }
0 157 elsif ($schema->{'type'} eq 'unblessed') { }
9 148 elsif ($schema->{'type'} eq 'code') { }
10 138 elsif ($schema->{'type'} eq 'regexp') { }
3 135 elsif ($schema->{'type'} eq 'list') { }
10 125 elsif ($schema->{'type'} =~ /^list\((.+)\)$/) { }
0 125 elsif ($schema->{'type'} eq 'table') { }
45 80 elsif ($schema->{'type'} =~ /^table\((.+)\)$/) { }
59 21 elsif ($schema->{'type'} eq 'struct') { }
14 7 elsif ($schema->{'type'} =~ /^ref\((.+)\)$/) { }
7 0 elsif ($schema->{'type'} =~ /^isa\((.+)\)$/) { }
787 5 2 unless $blessed
789 0 0 if $blessed
791 5 4 unless $reftype eq "CODE"
793 5 5 unless &is_regexp($data)
795 0 3 unless $reftype eq "ARRAY"
798 0 10 unless $reftype eq "ARRAY"
803 0 0 unless $reftype eq "HASH"
806 1 44 unless $reftype eq "HASH"
811 0 59 unless $reftype eq "HASH"
814 10 4 unless $reftype eq $1
816 5 2 unless $blessed and $data->isa($1)
820 112 21 unless @errors
837 0 849 if (ref $type eq "ARRAY")
841 58 791 if ($type =~ /^list\?\((.+)\)$/)
845 105 686 if ($type =~ /^valid\((.+)\)$/)
846 0 105 unless $valid->{$1}
850 11 675 if $type eq "anything"
852 11 664 if ($type =~ /^(undef|undefined)$/)
853 10 1 if defined $data
856 14 650 unless defined $data
858 10 640 if $type eq "defined"
860 436 204 if ($type =~ /^(string|boolean|number|integer)$/ or $type =~ /^(duration|size|hostname|ipv[46])$/) { }
863 18 418 if defined $reftype
867 33 171 unless defined $reftype
868 7 164 if $type =~ /^(reference|ref\(\*\))$/
871 214 368 if @errors
873 101 296 if $schema->{'check'}
874 395 2 unless @errors
895 1 35 if (@_ == 0) { }
33 2 elsif (@_ == 1) { }
1 1 elsif (@_ % 2 == 0) { }
910 4 31 if @errors
925 0 0 if (@_ == 0) { }
0 0 elsif (@_ == 1) { }
927 0 0 unless $self->{'schema'}{''}
932 0 0 unless $self->{'schema'}{$schema}
950 489 0 if (@_ == 1) { }
0 0 elsif (@_ == 2) { }
953 0 489 unless $self->{'schema'}{''}
959 0 0 unless $self->{'schema'}{$schema}
969 269 220 if @errors
981 0 2 if (@_ == 2) { }
2 0 elsif (@_ == 3) { }
985 0 0 unless $self->{'schema'}{''}
992 0 2 unless $self->{'schema'}{$schema}