1Config::Model::HashId(3U)ser Contributed Perl DocumentatiCoonnfig::Model::HashId(3)
2
3
4
6 Config::Model::HashId - Handle hash element for configuration model
7
9 version 2.136
10
12 See "SYNOPSIS" in Config::Model::AnyId
13
15 This class provides hash elements for a Config::Model::Node.
16
17 The hash index can either be en enumerated type, a boolean, an integer
18 or a string.
19
21 HashId object should not be created directly.
22
24 See model declaration section from Config::Model::AnyId.
25
27 get_type
28 Returns "hash".
29
30 fetch_size
31 Returns the number of elements of the hash.
32
33 sort
34 Sort an ordered hash. Throws an error if called on a non ordered hash.
35
36 insort
37 Parameters: key
38
39 Create a new element in the ordered hash while keeping alphabetical
40 order of the keys
41
42 Returns the newly created element.
43
44 Throws an error if called on a non ordered hash.
45
46 firstkey
47 Returns the first key of the hash. Behaves like "each" core perl
48 function.
49
50 nextkey
51 Returns the next key of the hash. Behaves like "each" core perl
52 function.
53
54 swap
55 Parameters: "( key1 , key2 )"
56
57 Swap the order of the 2 keys. Ignored for non ordered hash.
58
59 move
60 Parameters: "( key1 , key2 )"
61
62 Rename key1 in key2.
63
64 Also also optional check parameter to disable warning:
65
66 move ('foo','bar', check => 'no')
67
68 move_after
69 Parameters: "( key_to_move [ , after_this_key ] )"
70
71 Move the first key after the second one. If the second parameter is
72 omitted, the first key is placed in first position. Ignored for non
73 ordered hash.
74
75 move_up
76 Parameters: "( key )"
77
78 Move the key up in a ordered hash. Attempt to move up the first key of
79 an ordered hash is ignored. Ignored for non ordered hash.
80
81 move_down
82 Parameters: "( key )"
83
84 Move the key down in a ordered hash. Attempt to move up the last key of
85 an ordered hash is ignored. Ignored for non ordered hash.
86
87 load_data
88 Parameters: "( data => ( hash_ref | array_ref ) [ , check => ... , ...
89 ])"
90
91 Load data as a hash ref for standard hash.
92
93 Ordered hash should be loaded with an array ref or with a hash
94 containing a special "__order" element. E.g. loaded with either:
95
96 [ a => 'foo', b => 'bar' ]
97
98 or
99
100 { __order => ['a','b'], b => 'bar', a => 'foo' }
101
102 "__skip_order" parameter can be used if loading order is not important:
103
104 { __skip_order => 1, b => 'bar', a => 'foo'}
105
106 load_data can also be called with a single ref parameter.
107
109 Dominique Dumont, (ddumont at cpan dot org)
110
112 Config::Model, Config::Model::Instance, Config::Model::AnyId,
113 Config::Model::ListId, Config::Model::Value
114
116 Dominique Dumont
117
119 This software is Copyright (c) 2005-2019 by Dominique Dumont.
120
121 This is free software, licensed under:
122
123 The GNU Lesser General Public License, Version 2.1, February 1999
124
125
126
127perl v5.30.0 2019-08-04 Config::Model::HashId(3)