The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

TPath::Forester::Ref::Node - a node that represents a node in a plain struct

VERSION

version 0.003

DESCRIPTION

A container for the elements of a Perl data structure. Hash references are treated as lists of key-value pairs in alphabetical order.

ATTRIBUTES

value

The value this node represents.

tag

The hash key mapping of this node's value if it represents a key-value pair in a hash.

children

The node's children, if any.

type

The type of value held by this node:

hash
array
code
scalar
glob
object

A blessed reference.

undef

The undef value.

num

If it isn't a reference and it looks like a number according to scalar util.

string

Everything else.

is_first

Whether this is the first instance of this reference (or it isn't a reference).

is_repeated

Whether there are multiple references to this value. Something may be both first and repeated, but it must be repeated if it is not first. The actual value returned is the position of the reference in the repetition order. The tree is walked from left to right counting parents before children.

When a repeat is found, it is treated as a leaf. This ensures the nodes form a tree.

is_ref

Whether the value held by the node is a reference.

is_root

Whether this is the root node.

is_leaf

Whether this is a leaf node.

If this is a non-initial repeated reference, it is considered a leaf only if the initial reference is a leaf.

AUTHOR

David F. Houghton <dfhoughton@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by David F. Houghton.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.