NAME
Data::ZPath::Node - Node wrapper used by Data::ZPath
DESCRIPTION
Objects of this class wrap underlying Perl or XML values and provide traversal and type-coercion helpers used while evaluating ZPath expressions.
METHODS
from_root($value)
Create a new node from a root value.
raw
Return the wrapped underlying value.
parent
Return the parent node, or undef if this is a root node.
key
Return the key/name/index token used to reach this node.
id
Return a stable identifier string for deduplication where possible.
ix
Return the numeric sibling index for this node when available.
index
Alias for ix.
slot
Return an optional coderef used as a mutable scalar slot.
with_slot($coderef)
Attach a slot coderef to the node and return the node.
type
Return the ZPath type name of the wrapped value.
value
Return the wrapped value, normalizing boolean-like values.
primitive_value
Return a scalar representation suitable for ZPath primitive comparisons.
string_value
Return the wrapped value coerced to a string, if defined.
number_value
Return the wrapped value coerced to a number, if numeric.
children
Return wrapped child nodes.
For XML elements this returns child nodes, optionally excluding whitespace-only text nodes depending on $Data::ZPath::XmlIgnoreWS. For Perl hashes and arrays this returns wrapped value children.
attributes
Return wrapped XML attributes for an XML element.
name
Return the node name used by path matching.
dump
Return a plain Perl data structure for debugging.
find( $zpath )
Accepts either a Data::ZPath object or a ZPath string.
The following two are roughly equivalent:
$zpath->evaluate( $node )
$node->find( $zpath )
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
This software is copyright (c) 2026 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.