![]() |
![]()
| ![]() |
![]()
NAMEConfig::AST::Node - generic configuration syntax tree nodeSYNOPSISuse parent 'Config::AST::Node';DESCRIPTIONThis is an abstract class representing a node in the configuration parse tree. A node can be either a non-leaf node, representing a section, or a leaf node, representing a simple statement.METHODSnew(ARG => VAL, ...)Creates new object. Recognized arguments are:
$x = $node->locus;Returns a locus associated with the node.$node->locus($LOC)$node->locus($FILE, $LINE)Associates a locus with the node. In the second form, a new locus object is created for location $FILE:$LINE.$x = $node->order$node->order($N)Returns or sets and returns ordinal number for the node.$x = $node->default$node->default($N)Returns or sets and returns default value for the node.$node->is_leafReturns true if node is a leaf node$node->is_nullReturns true if node is a null node$node->is_sectionReturns true if node represents a section.$node->is_valueReturns true if node represents a value (or statement).@array = $cfg->flatten()@array = $cfg->flatten(sort => $sort)Returns a flattened representation of the configuration, as a list of pairs [ $path, $value ], where $path is a reference to the variable pathname, and $value is a Config::AST::Node::Value object.The $sort argument controls the ordering of the entries in the returned @array. It is either a code reference suitable to pass to the Perl sort function, or one of the following constants:
These constants are not exported by default. You can either import the ones you need, or use the :sort keyword to import them all, e.g.: use Config::AST::Node qw(:sort); @array = $node->flatten(sort => SORT_PATH); $cfg->canonical(%args)Returns the canonical string representation of the configuration node. For value nodes, canonical representation is:QVAR=VALUE where QVAR is fully qualified variable name, and VALUE is the corresponding value. For sections, canonical representation is a list of canonical representations of the underlying nodes, delimited by newlines (or another character - see the description of the delim argument, below). The list is sorted by QVAR in ascending lexicographical order. %args are zero or more of the following keywords:
SEE ALSOConfig::AST, Config::AST::Node::Null, Config::AST::Node::Value, Config::AST::Node::Section.
|