.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Config::Model::Node 3pm" .TH Config::Model::Node 3pm "2021-01-20" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Config::Model::Node \- Class for configuration tree node .SH "VERSION" .IX Header "VERSION" version 2.141 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Config::Model; \& \& # define configuration tree object \& my $model = Config::Model\->new; \& $model\->create_config_class( \& name => \*(AqOneConfigClass\*(Aq, \& class_description => "OneConfigClass detailed description", \& \& element => [ \& [qw/X Y Z/] => { \& type => \*(Aqleaf\*(Aq, \& value_type => \*(Aqenum\*(Aq, \& choice => [qw/Av Bv Cv/] \& } \& ], \& \& status => [ X => \*(Aqdeprecated\*(Aq ], \& description => [ X => \*(AqX\-ray description (can be long)\*(Aq ], \& summary => [ X => \*(AqX\-ray\*(Aq ], \& \& accept => [ \& \*(Aqip.*\*(Aq => { \& type => \*(Aqleaf\*(Aq, \& value_type => \*(Aquniline\*(Aq, \& summary => \*(Aqip address\*(Aq, \& } \& ] \& ); \& my $instance = $model\->instance (root_class_name => \*(AqOneConfigClass\*(Aq); \& my $root = $instance\->config_root ; \& \& # X is not shown below because of its deprecated status \& print $root\->describe,"\en" ; \& # name value type comment \& # Y [undef] enum choice: Av Bv Cv \& # Z [undef] enum choice: Av Bv Cv \& \& # add some data \& $root\->load( steps => \*(AqY=Av\*(Aq ); \& \& # add some accepted element, ipA and ipB are created on the fly \& $root\->load( steps => q!ipA=192.168.1.0 ipB=192.168.1.1"! ); \& \& # show also ip* element created in the last "load" call \& print $root\->describe,"\en" ; \& # name value type comment \& # Y Av enum choice: Av Bv Cv \& # Z [undef] enum choice: Av Bv Cv \& # ipA 192.168.1.0 uniline \& # ipB 192.168.1.1 uniline .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class provides the nodes of a configuration tree. When created, a node object gets a set of rules that defines its properties within the configuration tree. .PP Each node contain a set of elements. An element can contain: .IP "\(bu" 4 A leaf element implemented with Config::Model::Value. A leaf can be plain (unconstrained value) or be strongly typed (values are checked against a set of rules). .IP "\(bu" 4 Another node. .IP "\(bu" 4 A collection of items: a list element, implemented with Config::Model::ListId. Each item can be another node or a leaf. .IP "\(bu" 4 A collection of identified items: a hash element, implemented with Config::Model::HashId. Each item can be another node or a leaf. .SH "Configuration class declaration" .IX Header "Configuration class declaration" A class declaration is made of the following parameters: .IP "\fBname\fR" 4 .IX Item "name" Mandatory \f(CW\*(C`string\*(C'\fR parameter. This config class name can be used by a node element in another configuration class. .IP "\fBclass_description\fR" 4 .IX Item "class_description" Optional \f(CW\*(C`string\*(C'\fR parameter. This description is used while generating user interfaces. .IP "\fBclass\fR" 4 .IX Item "class" Optional \f(CW\*(C`string\*(C'\fR to specify a Perl class to override the default implementation (Config::Model::Node). This Perl Class \fBmust\fR inherit Config::Model::Node. Use with care. .IP "\fBelement\fR" 4 .IX Item "element" Mandatory \f(CW\*(C`list ref\*(C'\fR of elements of the configuration class : .Sp .Vb 3 \& element => [ foo => { type = \*(Aqleaf\*(Aq, ... }, \& bar => { type = \*(Aqleaf\*(Aq, ... } \& ] .Ve .Sp Element names can be grouped to save typing: .Sp .Vb 1 \& element => [ [qw/foo bar/] => { type = \*(Aqleaf\*(Aq, ... } ] .Ve .Sp See below for details on element declaration. .IP "\fBgist\fR" 4 .IX Item "gist" String used to construct a summary of the content of a node. This parameter is used by user interface to show users the gist of the content of this node. This parameter has no other effect. This string may contain element values in the form "\f(CW\*(C`{foo} or {bar}\*(C'\fR". When constructing the gist, \f(CW\*(C`{foo}\*(C'\fR is replaced by the value of element \&\f(CW\*(C`foo\*(C'\fR. Likewise for \f(CW\*(C`{bar}\*(C'\fR. .IP "\fBlevel\fR" 4 .IX Item "level" Optional \f(CW\*(C`list ref\*(C'\fR of the elements whose level are different from default value (\f(CW\*(C`normal\*(C'\fR). Possible values are \f(CW\*(C`important\*(C'\fR, \f(CW\*(C`normal\*(C'\fR or \f(CW\*(C`hidden\*(C'\fR. .Sp The level is used to set how configuration data is presented to the user in browsing mode. \f(CW\*(C`Important\*(C'\fR elements are shown to the user no matter what. \f(CW\*(C`hidden\*(C'\fR elements are explained with the \fIwarp\fR notion. .Sp .Vb 1 \& level => [ [qw/X Y/] => \*(Aqimportant\*(Aq ] .Ve .IP "\fBstatus\fR" 4 .IX Item "status" Optional \f(CW\*(C`list ref\*(C'\fR of the elements whose status are different from default value (\f(CW\*(C`standard\*(C'\fR). Possible values are \f(CW\*(C`obsolete\*(C'\fR, \&\f(CW\*(C`deprecated\*(C'\fR or \f(CW\*(C`standard\*(C'\fR. .Sp Using a deprecated element issues a warning. Using an obsolete element raises an exception (See Config::Model::Exception. .Sp .Vb 1 \& status => [ [qw/X Y/] => \*(Aqobsolete\*(Aq ] .Ve .IP "\fBdescription\fR" 4 .IX Item "description" Optional \f(CW\*(C`list ref\*(C'\fR of element summaries. These summaries may be used when generating user interfaces. .IP "\fBdescription\fR" 4 .IX Item "description" Optional \f(CW\*(C`list ref\*(C'\fR of element descriptions. These descriptions may be used when generating user interfaces. .IP "\fBrw_config\fR" 4 .IX Item "rw_config" .PD 0 .IP "\fBconfig_dir\fR" 4 .IX Item "config_dir" .PD Parameters used to load on demand configuration data. See Config::Model::BackendMgr for details. .IP "\fBaccept\fR" 4 .IX Item "accept" Optional list of criteria (i.e. a regular expression to match ) to accept unknown elements. Each criteria has a list of specification that enable \f(CW\*(C`Config::Model\*(C'\fR to create a model snippet for the unknown element. .Sp Example: .Sp .Vb 10 \& accept => [ \& \*(Aqlist.*\*(Aq => { \& type => \*(Aqlist\*(Aq, \& cargo => { \& type => \*(Aqleaf\*(Aq, \& value_type => \*(Aqstring\*(Aq, \& }, \& }, \& \*(Aqstr.*\*(Aq => { \& type => \*(Aqleaf\*(Aq, \& value_type => \*(Aquniline\*(Aq \& }, \& ] .Ve .Sp All \f(CW\*(C`element\*(C'\fR parameters can be used in specifying accepted elements. .Sp If Text::Levenshtein::Damerau is installed, a warning is issued if an accepted element is too close to an existing element. .Sp The parameter \f(CW\*(C`accept_after\*(C'\fR to specify where to insert the accepted element. This does not change much the behavior of the tree, but helps generate a more usable user interface. .Sp Example: .Sp .Vb 10 \& element => [ \& \*(AqBug\*(Aq => { type => \*(Aqleaf\*(Aq, value_type => \*(Aquniline\*(Aq } , \& ] \& accept => [ \& \*(AqBug\-.*\*(Aq => { \& value_type => \*(Aquniline\*(Aq, \& type => \*(Aqleaf\*(Aq \& accept_after => \*(AqBug\*(Aq , \& } \& ] .Ve .Sp The model snippet above ensures that \f(CW\*(C`Bug\-Debian\*(C'\fR is shown right after \f(CW\*(C`bug\*(C'\fR. .SH "Element declaration" .IX Header "Element declaration" .SS "Element type" .IX Subsection "Element type" Each element is declared with a list ref that contains all necessary information: .PP .Vb 3 \& element => [ \& foo => { ... } \& ] .Ve .PP This most important information from this hash ref is the mandatory \&\fBtype\fR parameter. The \fItype\fR type can be: .ie n .IP """node""" 8 .el .IP "\f(CWnode\fR" 8 .IX Item "node" The element is a node of a tree instantiated from a configuration class (declared with \&\*(L"create_config_class( ... )\*(R" in Config::Model). See \*(L"Node element\*(R". .ie n .IP """warped_node""" 8 .el .IP "\f(CWwarped_node\fR" 8 .IX Item "warped_node" The element is a node whose properties (mostly \f(CW\*(C`config_class_name\*(C'\fR) can be changed (warped) according to the values of one or more leaf elements in the configuration tree. See Config::Model::WarpedNode for details. .ie n .IP """leaf""" 8 .el .IP "\f(CWleaf\fR" 8 .IX Item "leaf" The element is a scalar value. See \*(L"Leaf element\*(R" .ie n .IP """hash""" 8 .el .IP "\f(CWhash\fR" 8 .IX Item "hash" The element is a collection of nodes or values (default). Each element of this collection is identified by a string (Just like a regular hash, except that you can set up constraint of the keys). See \*(L"Hash element\*(R" .ie n .IP """list""" 8 .el .IP "\f(CWlist\fR" 8 .IX Item "list" The element is a collection of nodes or values (default). Each element of this collection is identified by an integer (Just like a regular perl array, except that you can set up constraint of the keys). See \&\*(L"List element\*(R" .ie n .IP """check_list""" 8 .el .IP "\f(CWcheck_list\fR" 8 .IX Item "check_list" The element is a collection of values which are unique in the check_list. See CheckList. .ie n .IP """class""" 8 .el .IP "\f(CWclass\fR" 8 .IX Item "class" Override the default class for leaf, list and hash elements. The override class be inherit Config::Model::Value for leaf element, Config::Model::HashId for hash element and Config::Model::ListId for list element. .SS "Node element" .IX Subsection "Node element" When declaring a \f(CW\*(C`node\*(C'\fR element, you must also provide a \&\f(CW\*(C`config_class_name\*(C'\fR parameter. For instance: .PP .Vb 10 \& $model \->create_config_class \& ( \& name => "ClassWithOneNode", \& element => [ \& the_node => { \& type => \*(Aqnode\*(Aq, \& config_class_name => \*(AqAnotherClass\*(Aq, \& }, \& ] \& ) ; .Ve .SS "Leaf element" .IX Subsection "Leaf element" When declaring a \f(CW\*(C`leaf\*(C'\fR element, you must also provide a \&\f(CW\*(C`value_type\*(C'\fR parameter. See Config::Model::Value for more details. .SS "Hash element" .IX Subsection "Hash element" When declaring a \f(CW\*(C`hash\*(C'\fR element, you must also provide a \&\f(CW\*(C`index_type\*(C'\fR parameter. .PP You can also provide a \f(CW\*(C`cargo_type\*(C'\fR parameter set to \f(CW\*(C`node\*(C'\fR or \&\f(CW\*(C`leaf\*(C'\fR (default). .PP See Config::Model::HashId and Config::Model::AnyId for more details. .SS "List element" .IX Subsection "List element" You can also provide a \f(CW\*(C`cargo_type\*(C'\fR parameter set to \f(CW\*(C`node\*(C'\fR or \&\f(CW\*(C`leaf\*(C'\fR (default). .PP See Config::Model::ListId and Config::Model::AnyId for more details. .SH "Constructor" .IX Header "Constructor" The \f(CW\*(C`new\*(C'\fR constructor accepts the following parameters: .IP "config_file" 4 .IX Item "config_file" Specify configuration file to be used by backend. This parameter may override a file declared in the model. Note that this parameter is not propagated in children nodes. .SH "Introspection methods" .IX Header "Introspection methods" .SS "name" .IX Subsection "name" Returns the location of the node, or its config class name (for root node). .SS "get_type" .IX Subsection "get_type" Returns \f(CW\*(C`node\*(C'\fR. .SS "config_model" .IX Subsection "config_model" Returns the \fBentire\fR configuration model (Config::Model object). .SS "model" .IX Subsection "model" Returns the configuration model of this node (data structure). .SS "config_class_name" .IX Subsection "config_class_name" Returns the configuration class name of this node. .SS "instance" .IX Subsection "instance" Returns the instance object containing this node. Inherited from Config::Model::AnyThing .SS "has_element" .IX Subsection "has_element" Arguments: \f(CW\*(C`( name => element_name, [ type => searched_type ], [ autoadd => 1 ] )\*(C'\fR .PP Returns 1 if the class model has the element declared. .PP Returns 1 as well if \f(CW\*(C`autoadd\*(C'\fR is 1 (i.e. by default) and the element name is matched by the optional \f(CW\*(C`accept\*(C'\fR model parameter. .PP If \f(CW\*(C`type\*(C'\fR is specified, the element name must also match the type. .SS "find_element" .IX Subsection "find_element" Parameters: \f(CW\*(C`( element_name , [ case => any ])\*(C'\fR .PP Returns \f(CW$name\fR if the class model has the element declared or if the element name is matched by the optional \f(CW\*(C`accept\*(C'\fR parameter. .PP If \f(CW\*(C`case\*(C'\fR is set to any, \f(CW\*(C`has_element\*(C'\fR returns the element name who match the passed name in a case-insensitive manner. .PP Returns empty if no matching element is found. .SS "model_searcher" .IX Subsection "model_searcher" Returns an object dedicated to search an element in the configuration model. .PP This method returns a Config::Model::SearchElement object. See Config::Model::SearchElement for details on how to handle a search. .PP This method is inherited from Config::Model::AnyThing. .SS "element_model" .IX Subsection "element_model" Parameters: \f(CW\*(C`( element_name )\*(C'\fR .PP Returns model of the element. .SS "element_type" .IX Subsection "element_type" Parameters: \f(CW\*(C`( element_name )\*(C'\fR .PP Returns the type (e.g. leaf, hash, list, checklist or node) of the element. Also returns the type of a potentially accepted element. Dies if the element is not known or cannot be accepted. .SS "element_name" .IX Subsection "element_name" Returns the element name that contain this object. Inherited from Config::Model::AnyThing .SS "index_value" .IX Subsection "index_value" See \*(L"\fBindex_value()\fR\*(R" in Config::Model::AnyThing .SS "parent" .IX Subsection "parent" See \*(L"parent\*(R" in Config::Model::AnyThing .SS "root" .IX Subsection "root" See \*(L"root\*(R" in Config::Model::AnyThing .SS "location" .IX Subsection "location" See \*(L"location\*(R" in Config::Model::AnyThing .SS "backend_support_annotation" .IX Subsection "backend_support_annotation" Returns 1 if at least one of the backends attached to self or a parent node support to read and write annotations (aka comments) in the configuration file. .SH "Element property management" .IX Header "Element property management" .SS "get_element_names" .IX Subsection "get_element_names" Return all available element names, including the element that were accepted. .PP Optional parameters are: .IP "\(bu" 4 \&\fBall\fR: Boolean. When set return all element names, even the hidden ones and does not trigger warp mechanism. Defaults to 0. This option should be set to 1 when this method is needed to read configuration data from a backend. .IP "\(bu" 4 \&\fBtype\fR: Returns only element of requested type (e.g. \f(CW\*(C`list\*(C'\fR, \&\f(CW\*(C`hash\*(C'\fR, \f(CW\*(C`leaf\*(C'\fR,...). By default return elements of any type. .IP "\(bu" 4 \&\fBcargo_type\fR: Returns only hash or list elements that contain the requested cargo type. E.g. if \f(CW\*(C`get_element_names\*(C'\fR is called with \f(CW\*(C`cargo_type => \*(Aqleaf\*(Aq\*(C'\fR, then \f(CW\*(C`get_element_names\*(C'\fR returns hash or list elements that contain a leaf object. .IP "\(bu" 4 \&\fBcheck\fR: \f(CW\*(C`yes\*(C'\fR, \f(CW\*(C`no\*(C'\fR or \f(CW\*(C`skip\*(C'\fR .PP \&\f(CW\*(C`type\*(C'\fR and \f(CW\*(C`cargo_type\*(C'\fR parameters can be specified together. In this case, this method returns parameters that satisfy \fBboth\fR conditions. I.e. with \f(CW\*(C`type =>\*(Aqhash\*(Aq, cargo_type => \*(Aqleaf\*(Aq\*(C'\fR, this method returns only hash elements that contain leaf objects. .PP Returns a list in array context, and a string (e.g. \f(CW\*(C`join(\*(Aq \*(Aq,@array)\*(C'\fR) in scalar context. .SS "children" .IX Subsection "children" Like \f(CW\*(C`get_element_names\*(C'\fR without parameters. Returns the list of elements. This method is polymorphic for all non-leaf objects of the configuration tree. .SS "next_element" .IX Subsection "next_element" This method provides a way to iterate through the elements of a node. Mandatory parameter is \f(CW\*(C`name\*(C'\fR. Optional parameter: \f(CW\*(C`status\*(C'\fR. .PP Returns the next element name for status (default \f(CW\*(C`normal\*(C'\fR). Returns undef if no next element is available. .SS "previous_element" .IX Subsection "previous_element" Parameters: \f(CW\*(C`( name => element_name )\*(C'\fR .PP This method provides a way to iterate through the elements of a node. .PP Returns the previous element name. Returns undef if no previous element is available. .SS "get_element_property" .IX Subsection "get_element_property" Parameters: \f(CW\*(C`( element => ..., property => ... )\*(C'\fR .PP Retrieve a property of an element. .PP I.e. for a model : .PP .Vb 2 \& status => [ X => \*(Aqdeprecated\*(Aq ] \& element => [ X => { ... } ] .Ve .PP This call returns \f(CW\*(C`deprecated\*(C'\fR: .PP .Vb 1 \& $node\->get_element_property ( element => \*(AqX\*(Aq, property => \*(Aqstatus\*(Aq ) .Ve .SS "set_element_property" .IX Subsection "set_element_property" Parameters: \f(CW\*(C`( element => ..., property => ... )\*(C'\fR .PP Set a property of an element. .SS "reset_element_property" .IX Subsection "reset_element_property" Parameters: \f(CW\*(C`( element => ... )\*(C'\fR .PP Reset a property of an element according to the original model. .SH "Information management" .IX Header "Information management" .SS "fetch_element" .IX Subsection "fetch_element" Arguments: \f(CW\*(C`( name => .. , [ check => ..], [ autoadd => 1 ] )\*(C'\fR .PP Fetch and returns an element from a node if the class model has the element declared. .PP Also fetch and returns an element from a node if \f(CW\*(C`autoadd\*(C'\fR is 1 (i.e. by default) and the element name is matched by the optional \&\f(CW\*(C`accept\*(C'\fR model parameter. .PP \&\f(CW\*(C`check\*(C'\fR can be set to \f(CW\*(C`yes\*(C'\fR, \f(CW\*(C`no\*(C'\fR or \f(CW\*(C`skip\*(C'\fR. When \f(CW\*(C`check\*(C'\fR is \f(CW\*(C`no\*(C'\fR or \f(CW\*(C`skip\*(C'\fR, this method returns \f(CW\*(C`undef\*(C'\fR when the element is unknown, or 0 if the element is not available (hidden). .PP By default, \*(L"accepted\*(R" elements are automatically created. Set \&\f(CW\*(C`autoadd\*(C'\fR to 0 when this behavior is not wanted. .SS "fetch_element_value" .IX Subsection "fetch_element_value" Parameters: \f(CW\*(C`( name => ... [ check => ...] )\*(C'\fR .PP Fetch and returns the \fIvalue\fR of a leaf element from a node. .SS "fetch_gist" .IX Subsection "fetch_gist" Return the gist of the node. See description of \f(CW\*(C`gist\*(C'\fR parameter above. .SS "store_element_value" .IX Subsection "store_element_value" Parameters: \f(CW\*(C`( name, value )\*(C'\fR .PP Store a \fIvalue\fR in a leaf element from a node. .PP Can be invoked with named parameters (name, value, check). E.g. .PP .Vb 1 \& ( name => \*(Aqfoo\*(Aq, value => \*(Aqbar\*(Aq, check => \*(Aqskip\*(Aq ) .Ve .SS "is_element_available" .IX Subsection "is_element_available" Parameters: \f(CW\*(C`( name => ..., )\*(C'\fR .PP Returns 1 if the element \f(CW\*(C`name\*(C'\fR is available and if the element is not \*(L"hidden\*(R". Returns 0 otherwise. .PP As a syntactic sugar, this method can be called with only one parameter: .PP .Vb 1 \& is_element_available( \*(Aqelement_name\*(Aq ) ; .Ve .SS "accept_element" .IX Subsection "accept_element" Parameters: \f(CW\*(C`( name )\*(C'\fR .PP Checks and returns the appropriate model of an acceptable element (i.e. declared as a model \f(CW\*(C`element\*(C'\fR or part of an \f(CW\*(C`accept\*(C'\fR declaration). Returns undef if the element cannot be accepted. .SS "accept_regexp" .IX Subsection "accept_regexp" Parameters: \f(CW\*(C`( name )\*(C'\fR .PP Returns the list of regular expressions used to check for acceptable parameters. Useful for diagnostics. .SS "element_exists" .IX Subsection "element_exists" Parameters: \f(CW\*(C`( element_name )\*(C'\fR .PP Returns 1 if the element is known in the model. .SS "is_element_defined" .IX Subsection "is_element_defined" Parameters: \f(CW\*(C`( element_name )\*(C'\fR .PP Returns 1 if the element is defined. .SS "grab" .IX Subsection "grab" See \*(L"grab\*(R"" in Config::Model::Role::Grab. .SS "grab_value" .IX Subsection "grab_value" See \*(L"grab_value\*(R"" in Config::Model::Role::Grab. .SS "grab_root" .IX Subsection "grab_root" See \*(L"grab_root\*(R" in Config::Model::Role::Grab. .SS "get" .IX Subsection "get" Parameters: \f(CW\*(C`( path => ..., mode => ... , check => ... , get_obj => 1|0, autoadd => 1|0)\*(C'\fR .PP Get a value from a directory like path. If \f(CW\*(C`get_obj\*(C'\fR is 1, \f(CW\*(C`get\*(C'\fR returns a leaf object instead of returning its value. .SS "set" .IX Subsection "set" Parameters: \f(CW\*(C`( path , value)\*(C'\fR .PP Set a value from a directory like path. .SH "Validation" .IX Header "Validation" .SS "deep_check" .IX Subsection "deep_check" Scan the tree and deep check on all elements that support this. Currently only hash or list element have this feature. .SH "data modification" .IX Header "data modification" .SS "migrate" .IX Subsection "migrate" Force a read of the configuration and perform all changes regarding deprecated elements or values. Return 1 if data needs to be saved. .SS "apply_fixes" .IX Subsection "apply_fixes" Scan the tree from this node and apply fixes that are attached to warning specifications. See \f(CW\*(C`warn_if_match\*(C'\fR or \f(CW\*(C`warn_unless_match\*(C'\fR in "" in Config::Model::Value. .SS "load" .IX Subsection "load" Parameters: \f(CW\*(C`( steps => string [ ... ])\*(C'\fR .PP Load configuration data from the string into the node and its siblings. .PP This string follows the syntax defined in Config::Model::Loader. See \*(L"load\*(R" in Config::Model::Loader for details on parameters. .PP This method can also be called with a single parameter: .PP .Vb 1 \& $node\->load("some data:to be=loaded"); .Ve .SS "load_data" .IX Subsection "load_data" Parameters: \f(CW\*(C`( data => hash_ref, [ check => $check, ... ])\*(C'\fR .PP Load configuration data with a hash ref. The hash ref key must match the available elements of the node (or accepted element). The hash ref structure must match the structure of the configuration model. .PP Use \f(CW\*(C`check => skip\*(C'\fR to make data loading more tolerant: bad data are discarded. .PP \&\f(CW\*(C`load_data\*(C'\fR can be called with a single hash ref parameter. .PP Returns 1 if some data were saved (instead of skipped). .SS "needs_save" .IX Subsection "needs_save" return 1 if one of the elements of the node's sub-tree has been modified. .SH "Serialization" .IX Header "Serialization" .SS "dump_tree" .IX Subsection "dump_tree" Dumps the configuration data of the node and its siblings into a string. See \*(L"dump_tree\*(R" in Config::Model::Dumper for parameter details. .PP This string follows the syntax defined in Config::Model::Loader. The string produced by \f(CW\*(C`dump_tree\*(C'\fR can be passed to \f(CW\*(C`load\*(C'\fR. .SS "dump_annotations_as_pod" .IX Subsection "dump_annotations_as_pod" Dumps the configuration annotations of the node and its siblings into a string. See \*(L"dump_annotations_as_pod\*(R" in Config::Model::Dumper for parameter details. .SS "describe" .IX Subsection "describe" Parameters: \f(CW\*(C`( [ element => ... ] )\*(C'\fR .PP Provides a description of the node elements or of one element. .SS "report" .IX Subsection "report" Provides a text report on the content of the configuration below this node. .SS "audit" .IX Subsection "audit" Provides a text audit on the content of the configuration below this node. This audit shows only value different from their default value. .SS "copy_from" .IX Subsection "copy_from" Parameters: \f(CW\*(C`( from => another_node_object, [ check => ... ] )\*(C'\fR .PP Copy configuration data from another node into this node and its siblings. The copy can be made in a \fItolerant\fR mode where invalid data is discarded with \f(CW\*(C`check => skip\*(C'\fR. This method can be called with a single argument: \f(CW\*(C`copy_from($another_node)\*(C'\fR .SH "Help management" .IX Header "Help management" .SS "get_help" .IX Subsection "get_help" Parameters: \f(CW\*(C`( [ [ description | summary ] => element_name ] )\*(C'\fR .PP If called without element, returns the description of the class (Stored in \f(CW\*(C`class_description\*(C'\fR attribute of a node declaration). .PP If called with an element name, returns the description of the element (Stored in \f(CW\*(C`description\*(C'\fR attribute of a node declaration). .PP If called with 2 argument, either return the \f(CW\*(C`summary\*(C'\fR or the \&\f(CW\*(C`description\*(C'\fR of the element. .PP Returns an empty string if no description was found. .SS "get_info" .IX Subsection "get_info" Returns a list of information related to the node. See \&\*(L"get_info\*(R" in Config::Model::Value for more details. .SS "tree_searcher" .IX Subsection "tree_searcher" Parameters: \f(CW\*(C`( type => ... )\*(C'\fR .PP Returns an object able to search the configuration tree. Parameters are : .IP "type" 4 .IX Item "type" Where to perform the search. It can be \f(CW\*(C`element\*(C'\fR, \f(CW\*(C`value\*(C'\fR, \&\f(CW\*(C`key\*(C'\fR, \f(CW\*(C`summary\*(C'\fR, \f(CW\*(C`description\*(C'\fR, \f(CW\*(C`help\*(C'\fR or \f(CW\*(C`all\*(C'\fR. .PP Then, \f(CW\*(C`search\*(C'\fR method must then be called on the object returned by \f(CW\*(C`tree_searcher\*(C'\fR. .PP Returns a Config::Model::TreeSearcher object. .SS "Lazy load of node data" .IX Subsection "Lazy load of node data" As configuration model are getting bigger, the load time of a tree gets longer. The Config::Model::BackendMgr class provides a way to load the configuration information only when needed. .SH "AUTHOR" .IX Header "AUTHOR" Dominique Dumont, (ddumont at cpan dot org) .SH "SEE ALSO" .IX Header "SEE ALSO" Config::Model, Config::Model::Instance, Config::Model::HashId, Config::Model::ListId, Config::Model::CheckList, Config::Model::WarpedNode, Config::Model::Value .SH "AUTHOR" .IX Header "AUTHOR" Dominique Dumont .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2005\-2021 by Dominique Dumont. .PP This is free software, licensed under: .PP .Vb 1 \& The GNU Lesser General Public License, Version 2.1, February 1999 .Ve