Branch Coverage

blib/lib/Config/Model/Value.pm
Criterion Covered Total %
branch 450 558 80.6


line true false branch
95 2733 44 unless defined $self->compute
104 3103 45 unless defined $self->compute
123 43 1 if ($self->has_error)
125 3 40 if $self->compute_obj
126 0 43 if $self->{'_migrate_from'}
159 300 3185 if (my $warp_info = $self->warp)
223 0 4033 if (exists $arg_ref->{'built_in'})
228 0 4033 if (defined $arg_ref->{'default'} and defined $arg_ref->{'upstream_default'})
238 7418 648 unless defined $def
239 42 606 if $self->value_type eq "boolean"
243 2 646 if $self->has_error
263 1619 45 unless $c_info
267 98 0 if defined $c_info->{$_}
291 43 2 if (defined $path and not ref $path)
295 0 43 if $path =~ /\$/u
297 0 42 unless $master->can("register_dependency")
315 3 104 if (scalar @$error)
339 13 0 if (ref $mig_ref eq 'HASH') { }
351 32 33 if defined $mig_ref->{$_}
375 10 19 if $self->{'migration_done'}
376 6 13 if $self->instance->initial_load
382 6 7 unless defined $result
389 0 7 unless ($ok)
397 7 0 if length $result
401 7 0 $ok ? :
405 878 213 ref $args[0] ? :
413 289 802 if defined $self->{'choice_hash'}
421 6 2176 if (defined $lv and not defined $self->{'choice_hash'}{$lv})
432 0 29 unless defined $str
435 0 27 if ($vt ne "uniline" and $vt ne "string" and $vt ne "enum")
445 0 29 if ($@)
458 0 26 unless defined $regexp_info
464 0 13 if ($vt ne "uniline" and $vt ne "string" and $vt ne "enum")
471 0 26 if (not ref $regexp_info and $what ne "warn")
475 26 0 ref $regexp_info ? :
482 0 29 if ($@)
490 0 29 unless ref $v eq "HASH"
503 0 1 unless defined $str
506 0 1 if ($vt ne "uniline" and $vt ne "string")
515 0 1 unless ($lines[0] =~ /^check:/u)
523 0 1 if ($@)
545 134 3900 if ($logger->is_trace)
550 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'})
563 455 35851 if defined $args{$_}
566 6 4028 if ($args{'replace'})
569 3 3 if (defined $old)
578 47 3984 if defined $args{'convert'}
579 29 4002 if defined $args{'match'}
581 26 8036 if defined $args{$_}
583 1 4030 if defined $args{'grammar'}
586 13 4018 if defined $args{'migrate_from'}
591 0 4031 if defined $self->{'write_as'} and $self->{'value_type'} ne "boolean"
593 0 4031 if scalar keys %args
597 17 4014 if ($self->has_warped_slaves)
611 3794 240 unless defined $args->{'help'}
623 1 4033 unless defined $value_type
630 628 3405 if ($value_type eq 'boolean') { }
965 2440 elsif ($value_type eq 'reference' or $value_type eq 'enum') { }
2440 0 elsif (&any(sub {
633 0 0 $self->{'data'} ? :
0 628 if defined $self->{'data'}
634 0 0 $self->{'preset'} ? :
0 628 if defined $self->{'preset'}
635 0 0 $self->{'layered'} ? :
0 628 if defined $self->{'layered'}
640 878 87 if defined $choice
646 0 2440 if defined $arg_ref->{'choice'}
654 0 0 unless defined $self->{'warp'}
663 51 4 if (defined $self->{'refer_to'}) { }
4 0 elsif (defined $self->{'computed_refer_to'}) { }
703 493 9996 if defined $self->{'index_value'}
718 0 0 unless (defined $self->compute)
721 0 0 if ($self->compute_obj->allow_user_override)
729 212 3 unless $self->{'backup'}{'choice'}
736 8 7 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
740 0 15 unless $self->{'choice'}
747 1 3 $type eq 'enum' ? :
748 1 3 @choice ? :
754 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) { }
768 0 0 $m ? :
0 4 if defined $m
772 0 16 if defined $v
784 1 3 if defined $v
795 1 51 unless @_
798 0 51 unless defined $on_value
802 0 25 if $k eq "" or $k eq ".*"
803 12 13 if $on_value =~ /^$k/u
813 0 9 unless (defined $self->{'choice'})
820 9 0 defined $value ? :
825 0 9 if $var eq "reference" and defined $self->{'referred_to_path'}
826 0 9 if $self->{'warp'}
840 161 4410 if ($logger->is_debug)
841 158 3 defined $value ? :
857 1449 3122 if (not defined $value) { }
0 3122 elsif (not defined $vt) { }
347 2775 elsif ($vt =~ /integer/u and $value =~ /^-?\d+$/u or $vt =~ /number/u and $value =~ /^-?\d+(\.\d+)?$/u) { }
1 2774 elsif ($vt =~ /integer/u and $value =~ /^-?\d+(\.\d+)?$/u) { }
5 2769 elsif ($vt eq 'file' or $vt eq 'dir') { }
108 2661 elsif ($vt eq 'reference') { }
758 1903 elsif ($vt eq 'enum') { }
246 1657 elsif ($vt eq 'boolean') { }
1 1656 elsif ($vt =~ /integer/u or $vt =~ /number/u) { }
689 967 elsif ($vt eq 'uniline') { }
967 0 elsif ($vt eq 'string') { }
869 16 331 if defined $self->{'max'} and $value > $self->{'max'}
871 0 347 if defined $self->{'min'} and $value < $self->{'min'}
877 5 0 if (defined $value)
879 4 1 if ($path->exists) { }
881 2 2 unless path($value)->$check_sub
891 108 0 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
895 5 103 if (length $value and defined $self->{'choice_hash'} and not defined $self->{'choice_hash'}{$value})
898 0 5 $quiet ? :
902 4 746 if (length $value and defined $self->{'choice_hash'} and not defined $self->{'choice_hash'}{$value})
905 0 4 $quiet ? :
910 5 241 unless $value =~ /^[01]$/u
918 1 688 if $value =~ /\n/u
928 0 0 if defined $self->{'choice'}
935 45 4526 if (defined $self->{'match_regexp'} and defined $value)
937 2 43 unless $value =~ /$self->{'match_regexp'}/u
940 3864 707 if ($mode ne "custom")
941 93 3771 if ($self->{'warn_if_match'})
945 41 28 $v =~ /$r/u ? :
951 28 3836 if ($self->{'warn_unless_match'})
955 20 20 $v =~ /$r/u ? :
962 4 3860 if $self->{'assert'}
964 39 3825 if $self->{'warn_unless'}
966 32 3832 if $self->{'warn_if'}
970 4 3112 if defined $value and $self->{'warn'}
972 5 4566 if (defined $self->{'validation_parser'} and defined $value)
976 3 2 defined $prd_check ? :
977 3 2 defined $prd_check ? :
978 2 3 unless ($prd_result)
980 0 2 if $err_msg
983 0 5 if $warn_msg
1003 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'})
1012 0 14 if defined $self->{'warped_attribute'}{'default'}
1024 49 4415 if @$error
1025 50 4414 if @$warn
1031 1901 2563 wantarray ? :
1040 83 101 if ($logger->is_debug)
1041 83 0 defined $ret ? :
1045 97 87 unless ($ret)
1047 93 4 if defined $$value_r
1048 6 91 if ($msg =~ /\$std_value/u)
1050 5 1 if defined $std
1052 0 97 unless $fix
1053 60 37 unless $apply_fix
1054 60 37 if defined $fix and not $apply_fix
1055 37 60 if defined $fix and $apply_fix
1095 0 75 if ($@)
1113 24 97 unless defined $$value_r
1133 4 90 if ($logger->is_trace)
1146 0 94 if ($i++ > 20)
1164 4 33 if ($fix_logger->is_info)
1173 0 37 if ($@)
1182 34 3 if ($_ ne $$value_r) { }
1198 4 30 if ($fix_logger->is_trace)
1207 4 30 if ($fix_logger->is_trace)
1216 33 1 if ($old_v ne $new_v)
1217 33 0 $msg ? :
1222 2 31 if defined $new_v and $self->has_warped_slaves
1234 62 6515 if ($logger->is_debug)
1243 0 6575 @args == 1 ? :
2 6575 @args == 0 ? :
1246 6577 0 exists $args{'value'} ? :
1250 1719 4858 if ($self->needs_check) { }
1257 1689 30 unless $err_count or $warn_count
1265 0 6577 wantarray ? :
1275 47 2 if ($self->has_warning and not $nowarning and not $silent)
1278 1 46 $str =~ /\n/u ? :
1282 7 46 if ($old_warn->{$w}) { }
1296 0 1664 @args == 3 ? :
313 1664 @args == 1 ? :
1304 109 1868 if $logger->is_debug
1314 200 1777 if $self->value_type eq "boolean"
1320 804 1172 if ($self->instance->initial_load)
1322 21 783 if ($incoming_value ne $value)
1326 1 803 if (defined $old_value and $old_value ne $value)
1329 2 802 if (defined $old_value and $old_value eq $value)
1334 75 1901 if (defined $old_value and $value eq $old_value)
1335 4 71 if $logger->is_info
1353 2 1895 if $user_cb
1366 133 1752 if ($self->instance->layered) { }
11 1741 elsif ($self->instance->preset) { }
1370 11 0 if $notify_change
1379 1620 121 if $notify_change and $old ne $new
1394 105 1796 if ($logger->is_debug)
1397 12 198 if $i->$_
1404 1880 21 if ($ok or $check eq 'no') { }
1410 18 3 if ($check eq 'skip') { }
1411 6 12 if (not $silent and $self->has_error)
1415 0 6 if $args{'say_dont_warn'}
1416 6 0 unless $args{'say_dont_warn'}
1427 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)
1435 105 1792 if $logger->is_trace
1446 3 239 unless defined $$v_ref
1448 37 202 if (my $wa = $self->{'write_as'})
1451 24 50 if $wa->[$i] eq $$v_ref
1457 22 217 if $$v_ref =~ /^(y|yes|true|on)$/iu
1458 26 213 if $$v_ref =~ /^(n|no|false|off)$/iu or length $$v_ref == 0
1465 1977 0 @args > 1 ? :
1474 0 255 if $self->{'warp'} and defined $self->{'warp_info'} and @{$self->{'warp_info'}{'computed_master'};}
1476 1 1976 if (defined $self->compute_obj and not $self->compute_obj->allow_user_override)
1480 1 0 if $check eq "yes"
1485 44 1932 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
1490 38 1938 if defined $self->{'convert_sub'} and defined $value
1494 3 1973 if $self->{'replace'} and defined $value
1500 2 1974 if (not defined $value && length $value and $self->mandatory)
1511 4 2 if (defined $self->{'replace'}{$value}) { }
1517 1 3 if ($value =~ /^$k$/u)
1534 1838 63 unless $self->has_error or $self->has_warning
1541 1901 0 wantarray ? :
1552 0 0 unless defined $self->{'warp'}
1561 425 10 @args > 1 ? :
1566 0 435 if ($rd and &any(sub {
1574 41 394 if ($logger->is_info)
1595 4 6 defined $self->fetch('mode', 'custom', 'check', 'no', 'silent', '1') ? :
1606 55 3429 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
1618 0 9552 if (not defined $self->{'value_type'} and $check eq "yes")
1629 83 9418 $self->compute_is_default ? :
50 9502 defined $self->{'preset'} ? :
1633 4 9548 if (ref $e and $e->isa('Config::Model::Exception::User')) { }
0 9548 elsif (ref $e) { }
0 9548 elsif ($e) { }
1634 2 2 if ($check eq "yes")
1661 0 6 $self->compute_is_default ? :
0 6 defined $self->{'preset'} ? :
1664 0 6 if ($@)
1682 0 16176 if ($mode and not defined $accept_mode{$mode})
1691 69 7944 if $logger->is_trace
1697 170 695 if (defined $pref and not $self->{'notified_change_for_default'} and not defined $data)
1699 42 123 $self->compute_is_default ? :
5 165 defined $self->{'preset'} ? :
1709 6 7673 $self->compute_is_upstream_default ? :
332 7679 defined $layer_data ? :
1710 865 7146 defined $pref ? :
1712 23 7988 if (defined $self->{'_migrate_from'} and not defined $data)
1717 16022 0 unless $mode eq $k
1722 0 8011 if (my $err = $self->is_bad_mode($mode))
1726 3082 4929 if ($mode eq "custom")
1733 1085 95 if $data ne $pref and $data ne $self->{'upstream_default'} and $data ne $layer_data
1734 0 3082 if $logger->is_debug
1739 6 4923 if ($mode eq "non_upstream_default")
1744 5 4 if (defined $d and $d ne $self->{'upstream_default'})
1750 0 6 if $logger->is_debug
1756 95 4828 if (&any(sub {
50 4778 elsif ($mode eq 'standard') { }
2782 1996 elsif ($mode eq 'backend') { }
1996 0 elsif (&any(sub {
1772 69 4854 if $logger->is_debug
1782 1021 3757 if (&any(sub {
1788 1943 1814 length $data ? :
1807 6 1756 defined $self->{'_migrate_from'} ? :
16 1762 defined $self->{'compute'} ? :
7 1778 defined $self->{'preset'} ? :
429 1785 defined $self->{'data'} ? :
1813 3 18 if length $value > 15
1818 6175 1838 @args > 1 ? :
1823 69 7944 if ($logger->is_trace)
1835 69 7942 if ($logger->is_debug)
1836 58 11 defined $value ? :
1839 0 8011 if (my $err = $self->is_bad_mode($mode))
1843 4 8007 if (defined $self->{'replace_follow'} and defined $value)
1851 2 2 if (defined $rep and $rep ne $value)
1861 6575 1436 if $mode =~ /backend|custom|user/u and $check ne "no"
1864 69 7942 if $logger->is_trace
1868 7992 19 if ($ok or $check eq 'no') { }
1 18 elsif ($check eq 'skip') { }
1874 1 0 if not $silent and $msg
1891 71 10511 if ($self->{'write_as'} and $self->value_type eq 'boolean') { }
1893 46 27 defined $v && $v =~ /^\d+$/u ? :
1899 4646 5936 wantarray ? :
1935 2 0 @args > 1 ? :
1937 0 2 if ($path)
1947 0 1 if ($path)
1978 17 1278 if defined $self->{'depend_on_me'}