# internal class
DESCRIPTIONThis class must be inherited by all nodes or leaves of the configuration tree.
AnyThing provides some methods and no constructor.
element_name()Returns the element name that contain this object.
index_value()For object stored in an array or hash element, returns the index (or key) containing this object.
parent()Returns the node containing this object. May return undef if "parent()" is called on the root of the tree.
container_type()Returns the type (e.g. "list" or "hash" or "leaf" or "node" or "warped_node") of the element containing this object.
root()Returns the root node of the configuration tree.
location()Returns the node location in the configuration tree. This location conforms with the syntax defined by ``grab()'' method.
location_short()Returns the node location in the configuration tree. This location truncates long indexes to be readable. It cannot be used by ``grab()'' method.
composite_nameReturn the element name with its index (if any). I.e. returns "foo:bar" or "foo".
composite_name_shortReturn the element name with its index (if any). Too long indexes are truncated to be readable.
AnnotationAnnotation is a way to store miscellaneous information associated to each node. (Yeah... comments). Reading and writing annotation makes sense only if they can be read from and written to the configuration file, hence the need for the following method:
backend_support_annotationReturns 1 if at least one of the backends attached to a parent node support to read and write annotations (aka comments) in the configuration file.
support_annotationReturns 1 if at least one of the backends support to read and write annotations (aka comments) in the configuration file.
annotation( [ note1, [ note2 , ... ] ] )Without argument, return a string containing the object's annotation (or an empty string).
With several arguments, join the arguments with ``\n'', store the annotations and return the resulting string.
load_pod_annotation ( pod_string )Load annotations in configuration tree from a pod document. The pod must be in the form:
=over =item path Annotation text =back
clear_annotationClear the annotation of an element
grab(...)Grab an object from the configuration tree.
- "steps" (or "step")
- A string indicating the steps to follow in the tree to find the required item. (mandatory)
- When set to "strict", "grab" throws an exception if no object is found using the passed string. When set to "adaptative", the object found last is returned. For instance, for the steps "good_step wrong_step", only the object held by "good_step" is returned. When set to "loose", grab returns undef in case of problem. (default is "strict")
Either "node", "leaf", "hash" or "list" or an array ref containing these
values. Returns only an object of
requested type. Depending on "strict" value, "grab" either
throws an exception or returns the last object found with the requested type.
(optional, default to "undef", which means any type of object)
$root->grep(steps => 'foo:2 bar', type => 'leaf') $root->grep(steps => 'foo:2 bar', type => ['leaf','check_list'])
- When set to 1, "hash" or "list" configuration element are created when requested by the passed steps. (default is 1).
- When set to 1, grab returns an object even if this one is not available. I.e. even if this element was warped out. (default is 0).
The "steps" parameters is made of the following items separated by spaces:
- Go up one node
- Go to the root node.
- Go up the configuration tree until the "Foo" configuration class is found. Raise an exception if no "Foo" class is found when root node is reached.
- Go down using "xxx" element.
- Go down using "xxx" element and id "yy" (valid for hash or list elements)
Go up the tree until a node containing element "xxx" is found. Then go down
the tree like item "xxx".
If "?xxx:yy", go up the tree the same way. But no check is done to see if id "yy" actually exists or not. Only the element "xxx" is considered when going up the tree.
grab_value(...)Like ``grab(...)'', but returns the value of a leaf or check_list object, not just the leaf object.
"grab_value" raises an exception if following the steps ends on anything but a leaf or a check_list.
grab_annotation(...)Like ``grab(...)'', but returns the annotation of an object.
grab_root()Returns the root of the configuration tree.
grab_ancestor( Foo )Go up the configuration tree until the "Foo" configuration class is found. Returns the found node or undef.
notify_change(...)Notify the instance of semantic changes. Parameters are:
- old value. (optional)
- new value (optional)
- Location of the changed parameter starting from root node. Default to "$self-"location>.
- element name. Default to "$self-"element_name>
- If the changed parameter is part of a hash or an array, "index" contains the key or the index to get the changed parameter.
- information about the change. Mandatory of neither old or new value are defined.
- When set to 1, force recording of change even if in initial load phase.
- internal parameter.
show_message( string )Forwarded to ``show_message( string )'' in Config::Model::Instance.
model_searcher ()Returns an object dedicated to search an element in the configuration model (respecting privilege level).
This method returns a Config::Model::SearchElement object. See Config::Model::Searcher for details on how to handle a search.
dump_as_data ( )Dumps the configuration data of the node and its siblings into a perl data structure.
Returns a hash ref containing the data. See Config::Model::DumpAsData for details.
warp_errorReturns a string describing any issue with Config::Model::Warper object. Returns '' if invoked on a tree object without warp specification.
AUTHORDominique Dumont, (ddumont at cpan dot org)
COPYRIGHT AND LICENSEThis software is Copyright (c) 2005-2016 by Dominique Dumont.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999