Skip Menu |

This queue is for tickets about the Class-DBI CPAN distribution.

Report information
The Basics
Id: 15018
Status: resolved
Priority: 0/
Queue: Class-DBI

People
Owner: Nobody in particular
Requestors: support [...] 2rad.net
Cc:
AdminCc:

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

Attachments


Subject: Added distinct() support for Iterator
This is not a problem, but a first attempt at a new feature. I've included a patch with an added method distinct('methodname') to Iterator. The purpose is to return an Iterator or Array of all the items that are distinct from the original Iterator. Example: my $it = My::Class->search(foo => 'bar'); $it->count(); # lets say it returns 80 my $distinct_iterator = $it->distinct('myfoo'); $distinct_iterator->count(); # now returns 35 It is not very efficient as it will create the objects to run the methods, but it does get the job done. Hope its useful.
Download Iterator.pm_diff
application/octet-stream 1.2k

Message body not shown because it is not plain text.

Date: Wed, 12 Oct 2005 10:05:44 +0100
From: Tony Bowden <tony [...] tmtm.com>
To: bug-Class-DBI [...] rt.cpan.org
Subject: Re: [cpan #15018] Added distinct() support for Iterator
RT-Send-Cc:
Guest via RT wrote: Show quoted text
> This is not a problem, but a first attempt at a new feature. I've included a patch with an added method distinct('methodname') to Iterator. The purpose is to return an Iterator or Array of all the items that are distinct from the original Iterator.
I have to admit that I don't really see the point of this. However, you could always bundle this up as a Plugin that users can download from CPAN and use if they want this sort of feature. Tony