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

FreeBSD Manual Pages


home | help
Config::AST::Node::SecUser(Contributed Perl DocumConfig::AST::Node::Section(3)

       Config::AST::Node::Section - Configuration section node.

       Nodes of	this class represent configuration sections in the AST.

   new(ROOT, ARG => VAL, ...)
       Creates new section object. ROOT	is the root object of the tree or the
       Config::AST object. The ARG =_ VAL pairs	are passed to the parent class
       constructor (see	Config::AST::Node).

   $t =	$node->subtree
       Returns tree containing all subordinate nodes of	this node.

   $t =	$node->subtree($key)
       Returns the subnode at $key or undef if there is	no such	subnode.

   $t =	$node->subtree($key => $value)
       Creates new subnode with	the given $key and $value.  Returns the
       created node.

   @a =	$node->keys;
       Returns a list of names of all subordinate statements in	this section.

   $bool = $node->has_key($str)
       Returns true if statement with name $str	is present in the section
       described by $node.

       Deletes the node	with name $name. Returns the removed node, or "undef"
       if not found.

       Merges the section $other (a Config::AST::Node::Section)	to $node.

   $h =	$cfg->as_hash
   $h =	$cfg->as_hash($map)
       Returns parse tree converted to a hash reference. If $map is supplied,
       it must be a reference to a function. For each $key/$value pair,	this
       function	will be	called as:

	   ($newkey, $newvalue)	= &{$map}($what, $key, $value)

       where $what is "section"	or "value", depending on the type of the hash
       entry being processed. Upon successful return, $newvalue	will be
       inserted	in the hash slot for the key $newkey.

       If $what	is "section", $value is	always a reference to an empty hash
       (since the parse	tree is	traversed in pre-order fashion). In that case,
       the $map	function is supposed to	do whatever initialization that	is
       necessary for the new subtree and return	as $newvalue either $value
       itself, or a reference to a hash	available inside the $value. For

	   sub map {
	       my ($what, $name, $val) = @_;
	       if ($name eq 'section') {
		   $val->{section} = {};
		   $val	= $val->{section};
	       ($name, $val);

   $s =	$node->as_string
       Returns the string "(section)".

       Config::AST, Config::AST::Node.

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


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

home | help