NAME
Data::DPath::Context - Abstraction for a current context that enables incremental searches
API METHODS
new ( %args )
Constructor; creates instance.
Args:
- give_references
-
Default 0. If set to true value then results are references to the matched points in the data structure.
match( $dpath )
Return array of all data that match the given DPath.
matchr( $dpath )
Return array ref of all data that match the given DPath.
isearch( $path_str )
Searches a path relative to current context and returns an iterator. See Iterator style for usage.
ref()
It returns the reference to the actual data from the current context's first element. This mostly makes sense on contexts returned by iterators as there is only one point there.
(Having the reference theoretically allows you to even change the data on this point. It's not yet clear what impact this has to currently active iterators, which should still return the original data but that's not yet tested. So don't rely on that behaviour.)
deref()
This is one dereference step on top of ref(). It gives you the actual data found. Most of the time you want this.
first_point
On a current context consisting on a set of points it returns the first point. This makes most sense with Iterator style API when the current iterator contains exactly one point.
all_points
On a current context consisting on a set of points it returns all those. This method is a functional complement to first_point.
UTILITY SUBS/METHODS
_all
Returns all values covered by current context.
If give_references
is set to true value then results are references to the matched points in the data structure.
_search( $dpath )
Return new context for a DPath relative to current context.
_filter_points
Evaluates the filter condition in brackets. It differenciates between simple integers, which are taken as array index, and all other conditions, which are taken as evaled perl expression in a grep like expression onto the set of points found by current step.
current_points
Attribute / accessor.
give_references
Attribute / accessor.
aliased classes
That's just to make Pod::Coverage happy which does not handle aliased modules.
Context
Point
Step
AUTHOR
Steffen Schwigon <ss5@renormalist.net>
COPYRIGHT AND LICENSE
This software is copyright (c) 2024 by Steffen Schwigon.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.