Skip Menu |

This queue is for tickets about the Data-DPath CPAN distribution.

Report information
The Basics
Id: 106515
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: Data-DPath

People
Owner: schwigon [...] cpan.org
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Wishlist: return an arrayref (rather than an array) of matches
Hi, Thanks very much for this module. The number of items returned by match may be quite large. It would improve efficiency if one could get an arrayref of matches rather than an array. To retain backwards compatibility, perhaps a matchr() method? It'd be more natural for match() to return an arrayref in scalar context, but that's not backwards compatible. Thanks, Diab
Just to double check I understand on what you need: There already is a function "dpathr" which switches matching to return references of the found points, originally meant to patch the structure in place (https://metacpan.org/pod/Data::DPath#dpathr-path_str). This is *not* what you are talking about here. You talk about returning lets say 100 results (from dpath or dpathr) not as array but an array ref to not copy around 100 elements but only the arrayref to it. Am I correct? Steffen On Tue Aug 18 12:17:35 2015, DJERIUS wrote: Show quoted text
> Hi, > > Thanks very much for this module. > > The number of items returned by match may be quite large. It would > improve efficiency if one could get an arrayref of matches rather than > an array. To retain backwards compatibility, perhaps a matchr() > method? It'd be more natural for match() to return an arrayref in > scalar context, but that's not backwards compatible. > > Thanks, > > Diab
-- Steffen Schwigon <ss5@renormalist.net> Dresden Perl Mongers <http://dresden-pm.org/>
Yes, that's exactly it. On Tue Sep 01 02:39:56 2015, SCHWIGON wrote: Show quoted text
> Just to double check I understand on what you need: > > There already is a function "dpathr" which switches matching to return > references of the found points, originally meant to patch the > structure in place (https://metacpan.org/pod/Data::DPath#dpathr- > path_str). This is *not* what you are talking about here. > > You talk about returning lets say 100 results (from dpath or dpathr) > not as array but an array ref to not copy around 100 elements but only > the arrayref to it. > > Am I correct? > > Steffen > > On Tue Aug 18 12:17:35 2015, DJERIUS wrote:
> > Hi, > > > > Thanks very much for this module. > > > > The number of items returned by match may be quite large. It would > > improve efficiency if one could get an arrayref of matches rather > > than > > an array. To retain backwards compatibility, perhaps a matchr() > > method? It'd be more natural for match() to return an arrayref in > > scalar context, but that's not backwards compatible. > > > > Thanks, > > > > Diab
Please have a look at v0.54 I just uploaded to CPAN. If that doesn't solve your needs yet, please tell me. Thanks for your feedback. Kind regards, Steffen -- Steffen Schwigon <ss5@renormalist.net> Dresden Perl Mongers <http://dresden-pm.org/>
On Tue Sep 01 19:20:21 2015, SCHWIGON wrote: Show quoted text
> Please have a look at v0.54 I just uploaded to CPAN. > If that doesn't solve your needs yet, please tell me. > Thanks for your feedback. > > Kind regards, > Steffen
That works nicely. Thank you very much. Diab