blib/lib/Config/Model/models/Itself/WarpableElement.pl

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 100% 26 / 26 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Config/Model/models/Itself/WarpValue.pl ↑ Summary lib/Config/Model/models/Itself/ComputedValue.pl »
1 1 ▶#
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶# This file is part of Config-Model-Itself
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 #
4 # This software is Copyright (c) 2007-2026 by Dominique Dumont.
5 #
6 # This is free software, licensed under:
7 #
8 # The GNU Lesser General Public License, Version 2.1, February 1999
9 #
10 # Copyright (c) 2007-2011 Dominique Dumont.
11 #
12 # This file is part of Config-Model-Itself.
13 #
14 # Config-Model-Itself is free software; you can redistribute it
15 # and/or modify it under the terms of the GNU Lesser Public License
16 # as published by the Free Software Foundation; either version 2.1
17 # of the License, or (at your option) any later version.
18 #
19 # Config-Model-Itself is distributed in the hope that it will be
20 # useful, but WITHOUT ANY WARRANTY; without even the implied
21 # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 # See the GNU Lesser Public License for more details.
23 #
24 # You should have received a copy of the GNU Lesser Public License
25 # along with Config-Model-Itself; if not, write to the Free Software
26 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27  
28 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
29 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 return [
32 [
33 6 name => "Itself::WarpableElement",
34  
35 include => 'Itself::CommonElement',
36  
37 'element' => [
38  
39 [
40 qw/allow_keys_from allow_keys_matching follow_keys_from
41 warn_if_key_match warn_unless_key_match/
42 ] => {
43 type => 'leaf',
44 level => 'hidden',
45 value_type => 'uniline',
46 warp => {
47 follow => { 't' => '?type' },
48 'rules' => [{
49 when => '$t eq "hash"',
50 apply => { level => 'normal', }
51 }]
52 }
53 },
54  
55 [qw/ordered/] => {
56 type => 'leaf',
57 level => 'hidden',
58 value_type => 'boolean',
59 warp => {
60 follow => { 't' => '?type' },
61 'rules' => [{
62 when => '$t eq "hash" or $t eq "check_list"',
63 apply => { level => 'normal', }
64 }]
65 }
66 },
67  
68 [qw/default_keys auto_create_keys allow_keys/] => {
69 type => 'list',
70 level => 'hidden',
71 cargo => { type => 'leaf', value_type => 'string' },
72 warp => {
73 follow => { 't' => '?type' },
74 'rules' => [{
75 when => '$t eq "hash"',
76 apply => { level => 'normal', }
77 }]
78 }
79 },
80  
81 [qw/auto_create_ids/] => {
82 type => 'leaf',
83 level => 'hidden',
84 value_type => 'string',
85 warp => {
86 follow => { 't' => '?type' },
87 'rules' => [{
88 when => '$t eq "list"',
89 apply => { level => 'normal', }
90 }]
91 }
92 },
93  
94 'max_nb' => {
95 type => 'leaf',
96 level => 'hidden',
97 value_type => 'integer',
98 warp => {
99 follow => { 'type' => '?type', },
100 'rules' => [{
101 when => '$type eq "hash"',
102 apply => { level => 'normal', }
103 }]
104 }
105 },
106  
107 'replace' => {
108 type => 'hash',
109 index_type => 'string',
110 level => 'hidden',
111 warp => {
112 follow => { 't' => '?type' },
113 'rules' => [{
114 when => '$t eq "leaf" or $t eq "check_list"',
115 apply => { level => 'normal', }
116 }]
117 },
118  
119 # TBD this could be a reference if we restrict replace to
120 # enum value...
121 cargo => { type => 'leaf', value_type => 'string' },
122 },
123  
124 [ qw/duplicates/ ] => {
125 type => 'leaf',
126 level => 'hidden',
127 value_type => 'enum',
128 choice => [qw/allow suppress warn forbid/],
129 upstream_default => 'allow',
130 warp => {
131 follow => { 't' => '?type' },
132 'rules' => [{
133 when => '$t eq "hash" or $t eq "list"',
134 apply => { level => 'normal', }
135 }]
136 }
137 },
138  
139 help => {
140 type => 'hash',
141 index_type => 'string',
142 level => 'hidden',
143 warp => {
144 follow => { 't' => '?type' },
145 'rules' => [{
146 when => '$t eq "leaf" or $t eq "check_list"',
147 apply => { level => 'normal', }
148 }]
149 },
150  
151 # TBD this could be a reference if we restrict replace to
152 # enum value...
153 cargo => { type => 'leaf', value_type => 'string' },
154 },
155 ],
156  
157 'description' => [
158 follow_keys_from => 'this hash contains the same keys as the hash pointed by the path string',
159 allow_keys_from => 'this hash allows keys from the keys of the hash pointed by the path string',
160 ordered => 'keep track of the order of the elements of this hash',
161 default_keys => 'default keys hashes.',
162 auto_create_keys => 'always create a set of keys specified in this list',
163 auto_create_ids => 'always create the number of id specified in this integer',
164 allow_keys => 'specify a set of allowed keys',
165 allow_keys_matching => 'Keys must match the specified regular expression.',
166 help => 'Specify help string applicable to values. The keys are regexp matched to the beginning of the value. See C<help> parameter of L<Config::Model::Value/DESCRIPTION> for more possibilities',
167 replace => 'Used for enum to substitute one value with another. This parameter must be used to enable user to upgrade a configuration with obsolete values. The old value is the key of the hash, the new one is the value of the hash',
168 warn_if_key_match => 'Warn user if a key is created matching this regular expression',
169 warn_unless_key_match => 'Warn user if a key is created not matching this regular expression',
170 duplicates => 'Specify the policy regarding duplicated values stored in the list or as hash values (valid only when cargo type is "leaf"). The policy can be "allow" (default), "suppress", "warn" (which offers the possibility to apply a fix), "forbid".',
171 ],
172 ],
173  
174 ];
« blib/lib/Config/Model/models/Itself/WarpValue.pl ↑ Summary lib/Config/Model/models/Itself/ComputedValue.pl »