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

FreeBSD Manual Pages

  
 
  

home | help
Config::AST::Node::ValUser)Contributed Perl DocumenConfig::AST::Node::Value(3)

NAME
       Config::AST::Node::Value	- simple statement node

DESCRIPTION
       Implements a simple statement node. Simple statement is always
       associated with a value,	hence the class	name.

METHODS
   $node->value
       Returns the value associated with the statement.

       If value	is a code reference, it	is invoked without arguments, and its
       return is used as value.

       If the value is a reference to a	list or	hash, the return depends on
       the context. In scalar context, the reference itself is returned. In
       list context, the array or hash is returned.

   bool	= $node->is_leaf
       Returns false.

   $s =	$node->as_string
       Returns the node	value, converted to string.

   $s =	$node->as_number
       Returns the node	value, converted to number.

       If the value is an array, returns number	of elements in the array.  If
       the value is a hash, returns number of keys.  Otherwise,	returns	the
       value itself.

CONTEXT-SENSITIVE COERCIONS
       Depending on the	context	in which it is used, the
       Config::AST::Node::Value	is coerced to the most appropriate data	type.
       For example, in the following expression;

	  if ($cf->getnode('offset') < 10) {
	     ...
	  }

       the value will be coerced to a number prior to comparison.  This	means
       that in most cases you don't need to explicitly invoke the value
       method.

SEE ALSO
       Config::AST, Config::AST::Node.

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

NAME | DESCRIPTION | METHODS | CONTEXT-SENSITIVE COERCIONS | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Config::AST::Node::Value&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help