Data::...ontext(3pm)
π Data::...ontext(3pm) π
okay bestie, welcome to the manual page for Data::...ontext(3pm) β she's part of the User Contributed Perl Documentation crew, and she's here to teach you about an abstraction for a current context that enables incremental searches. yes, that's the whole vibe: context, but make it searchable, step by step, one little hop at a time. π¦
β¨ API METHODS β¨
π new ( %args )
Constructor, babes. She makes an instance. That's it, that's the job. π
Args:
give_referencesβ Defaults to0. If you set it to a true value then the results are references to the matched points in the data structure. So like, instead of the data itself you get the lil' pointer to where it lives. π
π§ match( $dpath )
Returns an array of all data that match the given DPath. All of it. Every last crumb. π
πΈ matchr( $dpath )
Same energy as match, except she hands you an array ref of all data that match the given DPath. One ref, all the goods. π«Ά
β isearch( $path_str )
Searches a path relative to the current context and returns an iterator. Peep the Iterator style section for how to actually use that thing. iykyk. π
π ref()
She returns the reference to the actual data from the current context's first element. This mostly makes sense on contexts returned by iterators, because there's literally only one point hanging out there. main character energy, single point, no crowd. π
okay so, tea time: having the reference theoretically allows you to even change the data on this point. But it's not yet clear what impact this has on currently active iterators β they should still return the original data, but that's not yet tested. So don't rely on that behaviour, bestie. we do not trust her yet. π
deref()
This is one dereference step on top of ref(). It gives you the actual data that was found. Most of the time, this is the one you want. no cap. β¨
first_point
On a current context that consists of a set of points, she returns the first point. This makes the most sense with the Iterator style API, when the current iterator contains exactly one point. tiny crowd, one point, she's your girl. π
all_points
On a current context that consists of a set of points, she returns all of those. This method is the functional complement to first_point. first_point found her, all_points brought the whole friend group. π«Ά
π UTILITY SUBS/METHODS π
_all
Returns all values covered by the current context.
If give_references is set to a true value, then the results are references to the matched points in the data structure. same rule as before, she's consistent like that. π
_search( $dpath )
Returns a new context for a DPath relative to the current context. fresh context, same drama. π¦
_filter_points
She evaluates the filter condition in brackets. And she differentiates between two things, so listen up:
- simple integers β these are taken as an array index.
- all other conditions β these are taken as an evaled perl expression in a
greplike expression onto the set of points found by the current step.
two paths, one function, she contains multitudes. π
current_points
Attribute / accessor. that's the whole description, she's mysterious like that. π
give_references
Attribute / accessor. again, short and iconic. π
π aliased classes π
That's just to make Pod::Coverage happy, because Pod::Coverage does not handle aliased modules. literally just doing it for the paperwork, bestie. π
ContextPointStep
π 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.
and that's the page, bestie!! π she was generated by perl v5.40.0 on 2024-10-05, and yes she's filed under that iconic truncated name Data::...ontext(3pm) β you know the one. go forth and match some data. slay. π
β¨
π¦ where this page comes from
- ubuntu resolute: libdata-dpath-perl 0.60-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdata-dpath-perl 0.60-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms