Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
Config::AST::Node(3)  User Contributed Perl Documentation Config::AST::Node(3)

       Config::AST::Node - generic configuration syntax	tree node

       use parent 'Config::AST::Node';

       This 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.

   new(ARG => VAL, ...)
       Creates new object. Recognized arguments	are:

       clone =>	OBJ
	   Clone object	OBJ, which must	be an instance of Config::AST::Node or
	   its derived class.

       default => VAL
	   Sets	default	value.

       locus =>	LOC
	   Sets	the locus - an object of class Text::Locus, which see.

       file => NAME
	   Sets	the file name.

       order =>	N
	   Sets	ordinal	number.

   $x =	$node->locus;
       Returns a locus associated with the node.

   $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
       Returns or sets and returns ordinal number for the node.

   $x =	$node->default
       Returns or sets and returns default value for the node.

       Returns true if node is a leaf node

       Returns true if node is a null node

       Returns true if node represents a section.

       Returns 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:

	   Don't sort the array.  Statements will be placed in an apparently
	   random order.

	   Preserve relative positions of the statements.  Entries in the
	   array will be in the	same order as they appeared in the
	   configuration file.	This is	the default.

	   Sort	by pathname.

       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);

       Returns the canonical string representation of the configuration	node.
       For value nodes,	canonical representation is:


       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:

       delim =>	STR
	   Use STR to delimit statements, instead of the newline.

       locus =>	1
	   Prefix each statement with its location.

       Config::AST, Config::AST::Node::Null, Config::AST::Node::Value,

perl v5.32.0			  2019-08-28		  Config::AST::Node(3)


Want to link to this manual page? Use this URL:

home | help