Branch Coverage

blib/lib/Config/Model/Value.pm
Criterion Covered Total %
branch 441 548 80.4


line true false branch
96 2708 44 unless defined $self->compute
105 3044 45 unless defined $self->compute
124 42 1 if ($self->has_error)
126 3 39 if $self->compute_obj
127 0 42 if $self->{'_migrate_from'}
160 300 3126 if (my $warp_info = $self->warp)
224 0 3974 if (exists $arg_ref->{'built_in'})
229 0 3974 if (defined $arg_ref->{'default'} and defined $arg_ref->{'upstream_default'})
239 7300 648 unless defined $def
240 42 606 if $self->value_type eq "boolean"
244 2 646 if $self->has_error
264 1563 45 unless $c_info
268 98 0 if defined $c_info->{$_}
292 43 2 if (defined $path and not ref $path)
296 0 43 if $path =~ /\$/u
298 0 42 unless $master->can("register_dependency")
316 3 104 if (scalar @$error)
340 13 0 if (ref $mig_ref eq 'HASH') { }
352 32 33 if defined $mig_ref->{$_}
376 10 19 if $self->{'migration_done'}
377 6 13 if $self->instance->initial_load
383 6 7 unless defined $result
390 0 7 unless ($ok)
398 7 0 if length $result
402 7 0 $ok ? :
406 878 213 ref $args[0] ? :
414 289 802 if defined $self->{'choice_hash'}
422 6 2176 if (defined $lv and not defined $self->{'choice_hash'}{$lv})
433 0 29 unless defined $str
436 0 27 if ($vt ne "uniline" and $vt ne "string" and $vt ne "enum")
446 0 29 if ($@)
459 0 26 unless defined $regexp_info
465 0 13 if ($vt ne "uniline" and $vt ne "string" and $vt ne "enum")
472 0 26 if (not ref $regexp_info and $what ne "warn")
476 26 0 ref $regexp_info ? :
483 0 29 if ($@)
491 0 29 unless ref $v eq "HASH"
504 0 1 unless defined $str
507 0 1 if ($vt ne "uniline" and $vt ne "string")
516 0 1 unless ($lines[0] =~ /^check:/u)
524 0 1 if ($@)
546 134 3841 if ($logger->is_trace)
551 0 0 if (defined $args{'value_type'} and $args{'value_type'} eq "reference" and not defined $self->{'refer_to'} and not defined $self->{'computed_refer_to'})
564 455 35320 if defined $args{$_}
567 6 3969 if ($args{'replace'})
570 3 3 if (defined $old)
579 47 3925 if defined $args{'convert'}
580 29 3943 if defined $args{'match'}
582 26 7918 if defined $args{$_}
584 1 3971 if defined $args{'grammar'}
587 13 3959 if defined $args{'migrate_from'}
592 0 3972 if defined $self->{'write_as'} and $self->{'value_type'} ne "boolean"
594 0 3972 if scalar keys %args
598 17 3955 if ($self->has_warped_slaves)
612 3735 240 unless defined $args->{'help'}
624 1 3974 unless defined $value_type
631 628 3346 if ($value_type eq 'boolean') { }
965 2381 elsif ($value_type eq 'reference' or $value_type eq 'enum') { }
2381 0 elsif (&any(sub {
634 0 0 $self->{'data'} ? :
0 628 if defined $self->{'data'}
635 0 0 $self->{'preset'} ? :
0 628 if defined $self->{'preset'}
636 0 0 $self->{'layered'} ? :
0 628 if defined $self->{'layered'}
641 878 87 if defined $choice
647 0 2381 if defined $arg_ref->{'choice'}
655 0 0 unless defined $self->{'warp'}
664 51 4 if (defined $self->{'refer_to'}) { }
4 0 elsif (defined $self->{'computed_refer_to'}) { }
704 481 9988 if defined $self->{'index_value'}
719 0 0 unless (defined $self->compute)
722 0 0 if ($self->compute_obj->allow_user_override)
730 212 3 unless $self->{'backup'}{'choice'}
737 8 7 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
741 0 15 unless $self->{'choice'}
748 1 3 $type eq 'enum' ? :
749 1 3 @choice ? :
755 1 3 if (defined $self->upstream_default) { }
0 3 elsif (defined $std) { }
1 2 elsif (defined $self->refer_to) { }
0 2 elsif (defined $self->computed_refer_to) { }
769 0 0 $m ? :
0 4 if defined $m
773 0 16 if defined $v
785 1 3 if defined $v
796 1 51 unless @_
799 0 51 unless defined $on_value
803 0 25 if $k eq "" or $k eq ".*"
804 12 13 if $on_value =~ /^$k/u
814 0 9 unless (defined $self->{'choice'})
821 9 0 defined $value ? :
826 0 9 if $var eq "reference" and defined $self->{'referred_to_path'}
827 0 9 if $self->{'warp'}
841 161 4352 if ($logger->is_debug)
842 158 3 defined $value ? :
858 1445 3068 if (not defined $value) { }
0 3068 elsif (not defined $vt) { }
347 2721 elsif ($vt =~ /integer/u and $value =~ /^-?\d+$/u or $vt =~ /number/u and $value =~ /^-?\d+(\.\d+)?$/u) { }
1 2720 elsif ($vt =~ /integer/u and $value =~ /^-?\d+(\.\d+)?$/u) { }
5 2715 elsif ($vt eq 'file' or $vt eq 'dir') { }
108 2607 elsif ($vt eq 'reference') { }
758 1849 elsif ($vt eq 'enum') { }
250 1599 elsif ($vt eq 'boolean') { }
1 1598 elsif ($vt =~ /integer/u or $vt =~ /number/u) { }
689 909 elsif ($vt eq 'uniline') { }
909 0 elsif ($vt eq 'string') { }
870 16 331 if defined $self->{'max'} and $value > $self->{'max'}
872 0 347 if defined $self->{'min'} and $value < $self->{'min'}
878 5 0 if (defined $value)
880 4 1 if ($path->exists) { }
882 2 2 unless path($value)->$check_sub
892 108 0 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
896 5 103 if (length $value and defined $self->{'choice_hash'} and not defined $self->{'choice_hash'}{$value})
899 0 5 $quiet ? :
903 4 746 if (length $value and defined $self->{'choice_hash'} and not defined $self->{'choice_hash'}{$value})
906 0 4 $quiet ? :
911 4 246 unless $value =~ /^[01]$/u
919 1 688 if $value =~ /\n/u
929 0 0 if defined $self->{'choice'}
936 45 4468 if (defined $self->{'match_regexp'} and defined $value)
938 2 43 unless $value =~ /$self->{'match_regexp'}/u
941 3806 707 if ($mode ne "custom")
942 93 3713 if ($self->{'warn_if_match'})
946 41 28 $v =~ /$r/u ? :
952 28 3778 if ($self->{'warn_unless_match'})
956 20 20 $v =~ /$r/u ? :
963 4 3802 if $self->{'assert'}
965 39 3767 if $self->{'warn_unless'}
967 32 3774 if $self->{'warn_if'}
971 4 3058 if defined $value and $self->{'warn'}
973 5 4508 if (defined $self->{'validation_parser'} and defined $value)
977 3 2 defined $prd_check ? :
978 3 2 defined $prd_check ? :
979 2 3 unless ($prd_result)
981 0 2 if $err_msg
984 0 5 if $warn_msg
1004 14 263 if ($self->{'mandatory'} and $check eq "yes" and $mode =~ /backend|user/u and not defined $value && length $value and not defined $self->{'layered'} && length $self->{'layered'})
1013 0 14 if defined $self->{'warped_attribute'}{'default'}
1025 48 4358 if @$error
1026 50 4356 if @$warn
1032 1846 2560 wantarray ? :
1041 83 101 if ($logger->is_debug)
1042 83 0 defined $ret ? :
1046 97 87 unless ($ret)
1048 93 4 if defined $$value_r
1049 6 91 if ($msg =~ /\$std_value/u)
1051 5 1 if defined $std
1053 0 97 unless $fix
1054 60 37 unless $apply_fix
1055 60 37 if defined $fix and not $apply_fix
1056 37 60 if defined $fix and $apply_fix
1096 0 75 if ($@)
1114 24 97 unless defined $$value_r
1134 4 90 if ($logger->is_trace)
1147 0 94 if ($i++ > 20)
1165 4 33 if ($fix_logger->is_info)
1174 0 37 if ($@)
1183 34 3 if ($_ ne $$value_r) { }
1199 4 30 if ($fix_logger->is_trace)
1208 4 30 if ($fix_logger->is_trace)
1217 33 1 if ($old_v ne $new_v)
1218 33 0 $msg ? :
1223 2 31 if defined $new_v and $self->has_warped_slaves
1235 62 6482 if ($logger->is_debug)
1244 0 6542 @args == 1 ? :
2 6542 @args == 0 ? :
1247 6544 0 exists $args{'value'} ? :
1251 1716 4828 if ($self->needs_check) { }
1258 1686 30 unless $err_count or $warn_count
1266 0 6544 wantarray ? :
1276 47 2 if ($self->has_warning and not $nowarning and not $silent)
1279 1 46 $str =~ /\n/u ? :
1283 7 46 if ($old_warn->{$w}) { }
1297 0 1605 @args == 3 ? :
312 1605 @args == 1 ? :
1305 109 1808 if $logger->is_debug
1315 198 1719 if $self->value_type eq "boolean"
1321 804 1112 if ($self->instance->initial_load)
1323 21 783 if ($incoming_value ne $value)
1327 1 803 if (defined $old_value and $old_value ne $value)
1330 2 802 if (defined $old_value and $old_value eq $value)
1335 70 1846 if (defined $old_value and $value eq $old_value)
1336 4 66 if $logger->is_info
1354 2 1840 if $user_cb
1367 133 1698 if ($self->instance->layered) { }
11 1687 elsif ($self->instance->preset) { }
1371 11 0 if $notify_change
1380 1567 120 if $notify_change and $old ne $new
1395 105 1741 if ($logger->is_debug)
1398 12 198 if $i->$_
1405 1826 20 if ($ok or $check eq 'no') { }
1411 17 3 if ($check eq 'skip') { }
1412 5 12 if (not $silent and $self->has_error)
1416 0 5 if $args{'say_dont_warn'}
1417 5 0 unless $args{'say_dont_warn'}
1428 100 0 if ($ok and defined $value and $self->has_warped_slaves and !defined($old_value) || $value ne $old_value and not $self->instance->layered || $self->instance->preset)
1436 105 1737 if $logger->is_trace
1447 2 238 unless defined $$v_ref
1449 37 201 if (my $wa = $self->{'write_as'})
1452 24 50 if $wa->[$i] eq $$v_ref
1458 22 216 if $$v_ref =~ /^(y|yes|true|on)$/iu
1459 26 212 if $$v_ref =~ /^(n|no|false|off)$/iu or length $$v_ref == 0
1466 1917 0 @args > 1 ? :
1475 0 255 if $self->{'warp'} and defined $self->{'warp_info'} and @{$self->{'warp_info'}{'computed_master'};}
1477 1 1916 if (defined $self->compute_obj and not $self->compute_obj->allow_user_override)
1481 1 0 if $check eq "yes"
1486 44 1872 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
1491 38 1878 if defined $self->{'convert_sub'} and defined $value
1495 3 1913 if $self->{'replace'} and defined $value
1501 2 1914 if (not defined $value && length $value and $self->mandatory)
1512 4 2 if (defined $self->{'replace'}{$value}) { }
1518 1 2 if ($value =~ /^$k$/u)
1535 1784 62 unless $self->has_error or $self->has_warning
1542 1846 0 wantarray ? :
1553 0 0 unless defined $self->{'warp'}
1562 425 10 @args > 1 ? :
1567 0 435 if ($rd and &any(sub {
1575 41 394 if ($logger->is_info)
1596 4 6 defined $self->fetch('mode', 'custom', 'check', 'no', 'silent', '1') ? :
1607 55 3370 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
1619 0 9460 if (not defined $self->{'value_type'} and $check eq "yes")
1630 83 9326 $self->compute_is_default ? :
50 9410 defined $self->{'preset'} ? :
1634 4 9456 if (ref $e and $e->isa('Config::Model::Exception::User')) { }
0 9456 elsif (ref $e) { }
0 9456 elsif ($e) { }
1635 2 2 if ($check eq "yes")
1662 0 6 $self->compute_is_default ? :
0 6 defined $self->{'preset'} ? :
1665 0 6 if ($@)
1683 0 16108 if ($mode and not defined $accept_mode{$mode})
1692 69 7910 if $logger->is_trace
1698 170 695 if (defined $pref and not $self->{'notified_change_for_default'} and not defined $data)
1700 42 123 $self->compute_is_default ? :
5 165 defined $self->{'preset'} ? :
1710 6 7639 $self->compute_is_upstream_default ? :
332 7645 defined $layer_data ? :
1711 865 7112 defined $pref ? :
1713 23 7954 if (defined $self->{'_migrate_from'} and not defined $data)
1718 15954 0 unless $mode eq $k
1723 0 7977 if (my $err = $self->is_bad_mode($mode))
1727 3082 4895 if ($mode eq "custom")
1734 1085 95 if $data ne $pref and $data ne $self->{'upstream_default'} and $data ne $layer_data
1735 0 3082 if $logger->is_debug
1740 6 4889 if ($mode eq "non_upstream_default")
1745 5 4 if (defined $d and $d ne $self->{'upstream_default'})
1751 0 6 if $logger->is_debug
1775 69 4820 if $logger->is_debug
1790 1914 1811 length $data ? :
1810 6 1698 defined $self->{'_migrate_from'} ? :
16 1704 defined $self->{'compute'} ? :
7 1720 defined $self->{'preset'} ? :
432 1727 defined $self->{'data'} ? :
1816 3 15 if length $value > 15
1821 6162 1817 @args > 1 ? :
1826 69 7910 if ($logger->is_trace)
1838 69 7908 if ($logger->is_debug)
1839 58 11 defined $value ? :
1842 0 7977 if (my $err = $self->is_bad_mode($mode))
1846 4 7973 if (defined $self->{'replace_follow'} and defined $value)
1854 2 2 if (defined $rep and $rep ne $value)
1864 6542 1435 if $mode =~ /backend|custom|user/u and $check ne "no"
1867 69 7908 if $logger->is_trace
1871 7958 19 if ($ok or $check eq 'no') { }
1 18 elsif ($check eq 'skip') { }
1877 1 0 if not $silent and $msg
1894 71 10370 if ($self->{'write_as'} and $self->value_type eq 'boolean') { }
1896 46 27 defined $v && $v =~ /^\d+$/u ? :
1902 4645 5796 wantarray ? :
1938 2 0 @args > 1 ? :
1940 0 2 if ($path)
1950 0 1 if ($path)
1981 17 1225 if defined $self->{'depend_on_me'}