Branch Coverage

blib/lib/Config/Model/Value.pm
Criterion Covered Total %
branch 439 546 80.4


line true false branch
96 2708 44 unless defined $self->compute
105 3044 45 unless defined $self->compute
124 3 39 if $self->compute_obj
125 0 42 if $self->{'_migrate_from'}
156 300 3126 if (my $warp_info = $self->warp)
220 0 3974 if (exists $arg_ref->{'built_in'})
225 0 3974 if (defined $arg_ref->{'default'} and defined $arg_ref->{'upstream_default'})
235 7300 648 unless defined $def
236 42 606 if $self->value_type eq "boolean"
240 2 646 if $self->has_error
260 1563 45 unless $c_info
264 98 0 if defined $c_info->{$_}
288 43 2 if (defined $path and not ref $path)
292 0 43 if $path =~ /\$/u
294 0 42 unless $master->can("register_dependency")
312 3 104 if (scalar @$error)
336 13 0 if (ref $mig_ref eq 'HASH') { }
348 32 33 if defined $mig_ref->{$_}
372 10 19 if $self->{'migration_done'}
373 6 13 if $self->instance->initial_load
379 6 7 unless defined $result
386 0 7 unless ($ok)
394 7 0 if length $result
398 7 0 $ok ? :
402 878 213 ref $args[0] ? :
410 289 802 if defined $self->{'choice_hash'}
418 6 2176 if (defined $lv and not defined $self->{'choice_hash'}{$lv})
429 0 29 unless defined $str
432 0 27 if ($vt ne "uniline" and $vt ne "string" and $vt ne "enum")
442 0 29 if ($@)
455 0 26 unless defined $regexp_info
461 0 13 if ($vt ne "uniline" and $vt ne "string" and $vt ne "enum")
468 0 26 if (not ref $regexp_info and $what ne "warn")
472 26 0 ref $regexp_info ? :
479 0 29 if ($@)
487 0 29 unless ref $v eq "HASH"
500 0 1 unless defined $str
503 0 1 if ($vt ne "uniline" and $vt ne "string")
512 0 1 unless ($lines[0] =~ /^check:/u)
520 0 1 if ($@)
542 134 3841 if ($logger->is_trace)
547 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'})
560 455 35320 if defined $args{$_}
563 6 3969 if ($args{'replace'})
566 3 3 if (defined $old)
575 47 3925 if defined $args{'convert'}
576 29 3943 if defined $args{'match'}
578 26 7918 if defined $args{$_}
580 1 3971 if defined $args{'grammar'}
583 13 3959 if defined $args{'migrate_from'}
588 0 3972 if defined $self->{'write_as'} and $self->{'value_type'} ne "boolean"
590 0 3972 if scalar keys %args
594 17 3955 if ($self->has_warped_slaves)
608 3735 240 unless defined $args->{'help'}
620 1 3974 unless defined $value_type
627 628 3346 if ($value_type eq 'boolean') { }
965 2381 elsif ($value_type eq 'reference' or $value_type eq 'enum') { }
2381 0 elsif (&any(sub {
630 0 0 $self->{'data'} ? :
0 628 if defined $self->{'data'}
631 0 0 $self->{'preset'} ? :
0 628 if defined $self->{'preset'}
632 0 0 $self->{'layered'} ? :
0 628 if defined $self->{'layered'}
637 878 87 if defined $choice
643 0 2381 if defined $arg_ref->{'choice'}
651 0 0 unless defined $self->{'warp'}
660 51 4 if (defined $self->{'refer_to'}) { }
4 0 elsif (defined $self->{'computed_refer_to'}) { }
700 481 9988 if defined $self->{'index_value'}
715 0 0 unless (defined $self->compute)
718 0 0 if ($self->compute_obj->allow_user_override)
726 212 3 unless $self->{'backup'}{'choice'}
733 8 7 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
737 0 15 unless $self->{'choice'}
744 1 3 $type eq 'enum' ? :
745 1 3 @choice ? :
751 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) { }
765 0 0 $m ? :
0 4 if defined $m
769 0 16 if defined $v
781 1 3 if defined $v
792 1 51 unless @_
795 0 51 unless defined $on_value
799 0 25 if $k eq "" or $k eq ".*"
800 12 13 if $on_value =~ /^$k/u
810 0 9 unless (defined $self->{'choice'})
817 9 0 defined $value ? :
822 0 9 if $var eq "reference" and defined $self->{'referred_to_path'}
823 0 9 if $self->{'warp'}
837 161 4353 if ($logger->is_debug)
838 158 3 defined $value ? :
854 1445 3069 if (not defined $value) { }
0 3069 elsif (not defined $vt) { }
347 2722 elsif ($vt =~ /integer/u and $value =~ /^-?\d+$/u or $vt =~ /number/u and $value =~ /^-?\d+(\.\d+)?$/u) { }
1 2721 elsif ($vt =~ /integer/u and $value =~ /^-?\d+(\.\d+)?$/u) { }
5 2716 elsif ($vt eq 'file' or $vt eq 'dir') { }
108 2608 elsif ($vt eq 'reference') { }
758 1850 elsif ($vt eq 'enum') { }
251 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') { }
866 16 331 if defined $self->{'max'} and $value > $self->{'max'}
868 0 347 if defined $self->{'min'} and $value < $self->{'min'}
874 5 0 if (defined $value)
876 4 1 if ($path->exists) { }
878 2 2 unless path($value)->$check_sub
888 108 0 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
892 5 103 if (length $value and defined $self->{'choice_hash'} and not defined $self->{'choice_hash'}{$value})
895 0 5 $quiet ? :
899 4 746 if (length $value and defined $self->{'choice_hash'} and not defined $self->{'choice_hash'}{$value})
902 0 4 $quiet ? :
907 4 247 unless $value =~ /^[01]$/u
915 1 688 if $value =~ /\n/u
925 0 0 if defined $self->{'choice'}
932 45 4469 if (defined $self->{'match_regexp'} and defined $value)
934 2 43 unless $value =~ /$self->{'match_regexp'}/u
937 3807 707 if ($mode ne "custom")
938 93 3714 if ($self->{'warn_if_match'})
942 41 28 $v =~ /$r/u ? :
948 28 3779 if ($self->{'warn_unless_match'})
952 20 20 $v =~ /$r/u ? :
959 4 3803 if $self->{'assert'}
961 39 3768 if $self->{'warn_unless'}
963 32 3775 if $self->{'warn_if'}
967 4 3059 if defined $value and $self->{'warn'}
969 5 4509 if (defined $self->{'validation_parser'} and defined $value)
973 3 2 defined $prd_check ? :
974 3 2 defined $prd_check ? :
975 2 3 unless ($prd_result)
977 0 2 if $err_msg
980 0 5 if $warn_msg
1000 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'})
1009 0 14 if defined $self->{'warped_attribute'}{'default'}
1021 48 4359 if @$error
1022 50 4357 if @$warn
1028 1847 2560 wantarray ? :
1037 83 101 if ($logger->is_debug)
1038 83 0 defined $ret ? :
1042 97 87 unless ($ret)
1044 93 4 if defined $$value_r
1045 6 91 if ($msg =~ /\$std_value/u)
1047 5 1 if defined $std
1049 0 97 unless $fix
1050 60 37 unless $apply_fix
1051 60 37 if defined $fix and not $apply_fix
1052 37 60 if defined $fix and $apply_fix
1092 0 75 if ($@)
1110 24 97 unless defined $$value_r
1130 4 90 if ($logger->is_trace)
1143 0 94 if ($i++ > 20)
1161 4 33 if ($fix_logger->is_info)
1170 0 37 if ($@)
1179 34 3 if ($_ ne $$value_r) { }
1195 4 30 if ($fix_logger->is_trace)
1204 4 30 if ($fix_logger->is_trace)
1213 33 1 if ($old_v ne $new_v)
1214 33 0 $msg ? :
1219 2 31 if defined $new_v and $self->has_warped_slaves
1231 62 6482 if ($logger->is_debug)
1240 0 6542 @args == 1 ? :
2 6542 @args == 0 ? :
1243 6544 0 exists $args{'value'} ? :
1247 1716 4828 if ($self->needs_check) { }
1254 1686 30 unless $err_count or $warn_count
1262 0 6544 wantarray ? :
1272 47 2 if ($self->has_warning and not $nowarning and not $silent)
1275 1 46 $str =~ /\n/u ? :
1279 7 46 if ($old_warn->{$w}) { }
1293 0 1605 @args == 3 ? :
312 1605 @args == 1 ? :
1301 109 1808 if $logger->is_debug
1311 198 1719 if $self->value_type eq "boolean"
1317 804 1112 if ($self->instance->initial_load)
1319 21 783 if ($incoming_value ne $value)
1323 1 803 if (defined $old_value and $old_value ne $value)
1326 2 802 if (defined $old_value and $old_value eq $value)
1331 69 1847 if (defined $old_value and $value eq $old_value)
1332 4 65 if $logger->is_info
1350 2 1841 if $user_cb
1363 133 1699 if ($self->instance->layered) { }
11 1688 elsif ($self->instance->preset) { }
1367 11 0 if $notify_change
1376 1568 120 if $notify_change and $old ne $new
1391 105 1742 if ($logger->is_debug)
1394 12 198 if $i->$_
1401 1827 20 if ($ok or $check eq 'no') { }
1407 17 3 if ($check eq 'skip') { }
1408 5 12 if (not $silent and $self->has_error)
1412 0 5 if $args{'say_dont_warn'}
1413 5 0 unless $args{'say_dont_warn'}
1424 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)
1432 105 1738 if $logger->is_trace
1443 2 238 unless defined $$v_ref
1445 37 201 if (my $wa = $self->{'write_as'})
1448 24 50 if $wa->[$i] eq $$v_ref
1454 22 216 if $$v_ref =~ /^(y|yes|true|on)$/iu
1455 26 212 if $$v_ref =~ /^(n|no|false|off)$/iu or length $$v_ref == 0
1462 1917 0 @args > 1 ? :
1471 0 255 if $self->{'warp'} and defined $self->{'warp_info'} and @{$self->{'warp_info'}{'computed_master'};}
1473 1 1916 if (defined $self->compute_obj and not $self->compute_obj->allow_user_override)
1477 1 0 if $check eq "yes"
1482 44 1872 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
1487 38 1878 if defined $self->{'convert_sub'} and defined $value
1491 3 1913 if $self->{'replace'} and defined $value
1497 2 1914 if (not defined $value && length $value and $self->mandatory)
1508 4 2 if (defined $self->{'replace'}{$value}) { }
1514 1 2 if ($value =~ /^$k$/u)
1531 1785 62 unless $self->has_error or $self->has_warning
1538 1847 0 wantarray ? :
1549 0 0 unless defined $self->{'warp'}
1558 425 10 @args > 1 ? :
1563 0 435 if ($rd and &any(sub {
1571 41 394 if ($logger->is_info)
1592 4 6 defined $self->fetch('mode', 'custom', 'check', 'no', 'silent', '1') ? :
1603 55 3370 if (defined $self->{'refer_to'} or defined $self->{'computed_refer_to'})
1615 0 9460 if (not defined $self->{'value_type'} and $check eq "yes")
1626 83 9326 $self->compute_is_default ? :
50 9410 defined $self->{'preset'} ? :
1630 4 9456 if (ref $e and $e->isa('Config::Model::Exception::User')) { }
0 9456 elsif (ref $e) { }
0 9456 elsif ($e) { }
1631 2 2 if ($check eq "yes")
1658 0 6 $self->compute_is_default ? :
0 6 defined $self->{'preset'} ? :
1661 0 6 if ($@)
1679 0 16108 if ($mode and not defined $accept_mode{$mode})
1688 69 7910 if $logger->is_trace
1694 170 695 if (defined $pref and not $self->{'notified_change_for_default'} and not defined $data)
1696 42 123 $self->compute_is_default ? :
5 165 defined $self->{'preset'} ? :
1706 6 7639 $self->compute_is_upstream_default ? :
332 7645 defined $layer_data ? :
1707 865 7112 defined $pref ? :
1709 23 7954 if (defined $self->{'_migrate_from'} and not defined $data)
1714 15954 0 unless $mode eq $k
1719 0 7977 if (my $err = $self->is_bad_mode($mode))
1723 3082 4895 if ($mode eq "custom")
1730 1085 95 if $data ne $pref and $data ne $self->{'upstream_default'} and $data ne $layer_data
1731 0 3082 if $logger->is_debug
1736 6 4889 if ($mode eq "non_upstream_default")
1741 5 4 if (defined $d and $d ne $self->{'upstream_default'})
1747 0 6 if $logger->is_debug
1771 69 4820 if $logger->is_debug
1786 1914 1811 length $data ? :
1806 6 1698 defined $self->{'_migrate_from'} ? :
16 1704 defined $self->{'compute'} ? :
7 1720 defined $self->{'preset'} ? :
433 1727 defined $self->{'data'} ? :
1812 3 15 if length $value > 15
1817 6162 1817 @args > 1 ? :
1822 69 7910 if ($logger->is_trace)
1834 69 7908 if ($logger->is_debug)
1835 58 11 defined $value ? :
1838 0 7977 if (my $err = $self->is_bad_mode($mode))
1842 4 7973 if (defined $self->{'replace_follow'} and defined $value)
1850 2 2 if (defined $rep and $rep ne $value)
1860 6542 1435 if $mode =~ /backend|custom|user/u and $check ne "no"
1863 69 7908 if $logger->is_trace
1867 7958 19 if ($ok or $check eq 'no') { }
1 18 elsif ($check eq 'skip') { }
1873 1 0 if not $silent and $msg
1890 71 10372 if ($self->{'write_as'} and $self->value_type eq 'boolean') { }
1892 46 27 defined $v && $v =~ /^\d+$/u ? :
1898 4645 5798 wantarray ? :
1934 2 0 @args > 1 ? :
1936 0 2 if ($path)
1946 0 1 if ($path)
1977 17 1226 if defined $self->{'depend_on_me'}