1Config::Model::AnyThingU(s3e)r Contributed Perl DocumentaCtoinofnig::Model::AnyThing(3)
2
3
4
6 Config::Model::AnyThing - Base class for configuration tree item
7
9 version 1.205
10
12 package Config::Model::Node ;
13 use base qw/Config::Model::AnyThing/ ;
14
16 This class must be inherited by all nodes or leaves of the
17 configuration tree.
18
19 AnyThing provides some methods and no constructor.
20
22 element_name()
23 Returns the element name that contain this object.
24
25 index_value()
26 For object stored in an array or hash element, returns the index (or
27 key) containing this object.
28
29 parent()
30 Returns the node containing this object. May return undef if "parent()"
31 is called on the root of the tree.
32
33 get_type()
34 Returns the type (e.g. "list" or "hash" or "leaf" or "node" or
35 "warped_node") of the element containing this object.
36
37 root()
38 Returns the root node of the configuration tree.
39
40 location()
41 Returns the node location in the configuration tree. This location
42 conforms with the syntax defined by "grab()" method.
43
44 composite_name
45 Return the element name with its index (if any). I.e. returns "foo:bar"
46 or "foo".
47
49 Annotation is a way to store miscellaneous information associated to
50 each node. (Yeah... comments) These comments will be saved outside of
51 the configuration file and restored the next time the command is run.
52
54 grab(...)
55 Grab an object from the configuration tree.
56
57 Parameters are:
58
59 step
60 A string indicating the steps to follow in the tree to find the
61 required item. (mandatory)
62
63 strict
64 When set to 1, "grab" will throw an exception if no object is found
65 using the passed string. When set to 0, the object found at last
66 will be returned. For instance, for the step "good_step
67 wrong_step", only the object held by "good_step" will be returned.
68 (default is 1)
69
70 type
71 Either "node", "leaf", "hash" or "list". Returns only an object of
72 requested type. Depending on "strict" value, "grab" will either
73 throw an exception or return the last found object of requested
74 type. (optional, default to "undef", which means any type of
75 object)
76
77 autoadd
78 When set to 1, "hash" or "list" configuration element are created
79 when requested by the passed steps. (default is 1).
80
81 grab_non_available
82 When set to 1, grab will return an object even if this one is not
83 available. I.e. even if this element was warped out. (default is
84 0).
85
86 The "step" parameters is made of the following items separated by
87 spaces:
88
89 - Go up one node
90
91 ! Go to the root node.
92
93 xxx Go down using "xxx" element.
94
95 xxx:yy Go down using "xxx" element and id "yy" (valid for hash or list
96 elements)
97
98 ?xxx Go up the tree until a node containing element "xxx" is found.
99 Then go down the tree like item "xxx".
100
101 If "?xxx:yy", go up the tree the same way. But no check is done
102 to see if id "yy" actually exists or not. Only the element
103 "xxx" is considered when going up the tree.
104
105 grab_value(...)
106 Like "grab(...)", but will return the value of a leaf object, not just
107 the leaf object.
108
109 Will raise an exception if following the steps ends on anything but a
110 leaf.
111
112 grab_annotation(...)
113 Like "grab(...)", but will return the annotation of an object.
114
115 grab_root()
116 Returns the root of the configuration tree.
117
118 searcher ()
119 Returns an object dedicated to search an element in the configuration
120 model (respecting privilege level).
121
122 This method returns a Config::Model::Searcher object. See
123 Config::Model::Searcher for details on how to handle a search.
124
125 dump_as_data ( )
126 Dumps the configuration data of the node and its siblings into a perl
127 data structure.
128
129 Returns a hash ref containing the data. See Config::Model::DumpAsData
130 for details.
131
133 Dominique Dumont, (ddumont at cpan dot org)
134
136 Config::Model, Config::Model::Instance, Config::Model::Node,
137 Config::Model::Loader, Config::Model::Dumper
138
139
140
141perl v5.12.1 2010-08-18 Config::Model::AnyThing(3)