1Config::Model::ListId(3U)ser Contributed Perl DocumentatiCoonnfig::Model::ListId(3)
2
3
4
6 Config::Model::ListId - Handle list element for configuration model
7
9 version 2.136
10
12 See "SYNOPSIS" in Config::Model::AnyId
13
15 This class provides list elements for a Config::Model::Node.
16
18 ListId object should not be created directly.
19
21 See model declaration section from Config::Model::AnyId.
22
24 get_type
25 Returns "list".
26
27 fetch_size
28 Returns the number of elements of the list.
29
30 load
31 Parameters: "(string, [ check => 'no' ] )"
32
33 Store a set of values passed as a comma separated list of values.
34 Values can be quoted strings. (i.e ""a,a",b" yields "('a,a', 'b')"
35 list).
36
37 "check" can be yes, no or skip
38
39 store_set
40 Store a set of values (passed as list)
41
42 If tinkering with check is required, use the following way :
43
44 store_set ( \@v , check => 'skip' );
45
46 move
47 Parameters: "( from_index, to_index, [ check => 'no' )"
48
49 Move an element within the list. "check" can be 'yes' 'no' 'skip'
50
51 push
52 Parameters: "( value1, [ value2 ... ] )"
53
54 push some values at the end of the list.
55
56 push_x
57 Parameters: "( values => [ v1','v2', ...] , ... )"
58
59 Like push with extended options. Options are:
60
61 check
62 Check value validaty. Either "yes" (default), "no", "skip"
63
64 values
65 Values to push (array_ref)
66
67 value
68 Single value to push
69
70 annotation
71
72 unshift
73 Parameters: "( value1, [ value2 ... ] )"
74
75 unshift some values at the end of the list.
76
77 insert_at
78 Parameters: "( idx, value1, [ value2 ... ] )"
79
80 unshift some values at index idx in the list.
81
82 insert_before
83 Parameters: "( ( val | qr/stuff/ ) , value1, [ value2 ... ] )"
84
85 unshift some values before value equal to "val" or before value
86 matching "stuff".
87
88 insort
89 Parameters: "( value1, [ value2 ... ] )"
90
91 Insert "zz" value on "xxx" list so that existing alphanumeric order is
92 preserved. "insort" yields unpexpected results when called on an
93 unsorted list.
94
95 store
96 Equivalent to push_x. This method is provided to help write
97 configuration parser, so the call is the same when dealing with leaf or
98 list values. Prefer "push_x" when practical.
99
100 check
101 "yes", "no" or "skip"
102
103 annotation
104 list ref of annotation to store with the list values
105
106 Example:
107
108 $elt->push_x (
109 values => [ 'v1','v2' ] ,
110 annotation => [ 'v1 comment', 'v2 comment' ],
111 check => 'skip'
112 );
113
114 sort
115 Sort the content of the list. Can only be called on list of leaf.
116
117 swap
118 Parameters: "( ida , idb )"
119
120 Swap 2 elements within the array
121
122 remove
123 Parameters: "( idx )"
124
125 Remove an element from the list. Equivalent to "splice @list,$idx,1"
126
127 load_data
128 Parameters: "( data => ( ref | scalar ) [, check => ... ] [ , split_reg
129 => $re ] )"
130
131 Clear and load list from data contained in the "data" array ref. If a
132 scalar or a hash ref is passed, the list is cleared and the data is
133 stored in the first element of the list. If split_reg is specified, the
134 scalar is split to load the array.
135
136 For instance
137
138 $elt->load_data( data => 'foo,bar', split_reg => qr(,) ) ;
139
140 loads " [ 'foo','bar']" in $elt
141
142 sort_algorithm
143 Returns a sub used to sort the list elements. See "sort" in perlfunc.
144 Used only for list of leaves. This method can be overridden to alter
145 sort order.
146
148 Dominique Dumont, (ddumont at cpan dot org)
149
151 Config::Model::Model, Config::Model::Instance, Config::Model::AnyId,
152 Config::Model::HashId, Config::Model::Value
153
155 Dominique Dumont
156
158 This software is Copyright (c) 2005-2019 by Dominique Dumont.
159
160 This is free software, licensed under:
161
162 The GNU Lesser General Public License, Version 2.1, February 1999
163
164
165
166perl v5.30.0 2019-08-04 Config::Model::ListId(3)