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 346 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 $$_Known{$1}
362 1 49 if defined $$data{$field} and not $$data{'type'} =~ /^(string|number|integer|list.*|table.*)$/
365 0 49 if defined $$data{$field} and not $$data{'type'} =~ /^(string|number|integer|list.*|table.*)$/
368 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)'
435 0 0 if ($type =~ /^list\?\((.+)\)$/)
438 0 0 if ($type =~ /^valid\((.+)\)$/)
439 0 0 unless $$valid{$1}
442 0 0 if ($type eq 'struct')
462 0 0 unless defined treeval($hash, $opt)
464 0 0 if @list == 2
475 0 0 unless not defined $opt1 or defined treeval($hash, $opt1)
477 0 0 if defined treeval($hash, $opt2)
478 0 0 if defined $opt1
491 0 0 unless not defined $opt1 or defined treeval($hash, $opt1)
493 0 0 if defined treeval($hash, $opt2)
495 0 0 if (@options <= 2) { }
501 0 0 if defined $opt1
518 0 1 unless $reftype eq 'ARRAY'
528 0 1 unless $reftype eq 'HASH'
538 0 2 unless $reftype eq 'HASH'
540 0 6 unless exists $$data{$key}
554 0 18 unless &$callback($valid, $schema, $type, $_[4], @path)
556 6 12 if $type =~ /^(boolean|number|integer)$/
557 0 12 if $type =~ /^(duration|size|hostname|ipv[46])$/
558 0 12 if $type =~ /^(undef|undefined|defined|blessed|unblessed)$/
559 0 12 if $type =~ /^(anything|string|regexp|object|reference|code)$/
562 8 4 if ($type =~ /^valid\((.+)\)$/)
563 0 8 unless $$valid{$1}
567 2 2 if ($type eq 'struct')
572 0 2 if ($type =~ /^list$/)
577 1 1 if ($type =~ /^list\((.+)\)$/)
582 0 1 if ($type =~ /^list\?\((.+)\)$/)
583 0 0 if ($reftype eq 'ARRAY') { }
592 0 1 if ($type =~ /^table$/)
597 1 0 if ($type =~ /^table\((.+)\)$/)
630 7 37 if defined $min and not $value >= $min
632 7 30 if defined $max and not $value <= $max
645 10 3 if defined $$schema{'min'} or defined $$schema{'max'}
648 4 9 if @errors
653 3 9 if @errors
670 6 38 if defined $$schema{'min'} or defined $$schema{'max'}
673 1 43 if @errors
676 1 56 if defined $$schema{'match'} and not $key =~ /$$schema{'match'}/
679 1 56 if @errors
681 5 51 if @errors
700 89 345 if exists $$data{$key}
701 342 3 if is_true($$schema{'fields'}{$key}{'optional'})
707 1 87 unless $$schema{'fields'}{$key}
710 3 84 if @errors
730 53 12 unless @tmperrors
746 67 351 if ($type eq 'string') { }
257 94 elsif ($type =~ /^(boolean|hostname|ipv[46])$/) { }
94 0 elsif ($type =~ /^(integer|number|duration|size)$/) { }
747 7 60 if defined $$schema{'min'} or defined $$schema{'max'}
750 3 60 if not @errors and defined $$schema{'match'} and not $data =~ /$$schema{'match'}/
755 121 136 unless $data =~ /$_RE{$type}/
757 13 123 if ($type eq 'hostname')
758 3 10 if ".$data." =~ /\.\d+\./
762 26 68 unless $data =~ /$_RE{$type}/
763 11 57 if defined $$schema{'min'} or defined $$schema{'max'}
769 256 12 unless @errors
784 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\((.+)\)$/) { }
785 5 2 unless $blessed
787 0 0 if $blessed
789 5 4 unless $reftype eq 'CODE'
791 5 5 unless &is_regexp($data)
793 0 3 unless $reftype eq 'ARRAY'
796 0 10 unless $reftype eq 'ARRAY'
801 0 0 unless $reftype eq 'HASH'
804 1 44 unless $reftype eq 'HASH'
809 0 59 unless $reftype eq 'HASH'
812 10 4 unless $reftype eq $1
814 5 2 unless $blessed and $data->isa($1)
818 112 21 unless @errors
835 0 849 if (ref $type eq 'ARRAY')
839 58 791 if ($type =~ /^list\?\((.+)\)$/)
843 105 686 if ($type =~ /^valid\((.+)\)$/)
844 0 105 unless $$valid{$1}
848 11 675 if $type eq 'anything'
850 11 664 if ($type =~ /^(undef|undefined)$/)
851 10 1 if defined $data
854 14 650 unless defined $data
856 10 640 if $type eq 'defined'
858 436 204 if ($type =~ /^(string|boolean|number|integer)$/ or $type =~ /^(duration|size|hostname|ipv[46])$/) { }
861 18 418 if defined $reftype
865 33 171 unless defined $reftype
866 7 164 if $type =~ /^(reference|ref\(\*\))$/
869 214 368 if @errors
870 101 296 if $$schema{'check'}
872 395 2 unless @errors
893 1 35 if (@_ == 0) { }
33 2 elsif (@_ == 1) { }
1 1 elsif (@_ % 2 == 0) { }
908 4 31 if @errors
923 0 0 if (@_ == 0) { }
0 0 elsif (@_ == 1) { }
924 0 0 unless $$self{'schema'}{''}
929 0 0 unless $$self{'schema'}{$schema}
948 489 0 if (@_ == 1) { }
0 0 elsif (@_ == 2) { }
950 0 489 unless $$self{'schema'}{''}
956 0 0 unless $$self{'schema'}{$schema}
967 269 220 if @errors
979 0 2 if (@_ == 2) { }
2 0 elsif (@_ == 3) { }
982 0 0 unless $$self{'schema'}{''}
989 0 2 unless $$self{'schema'}{$schema}