Re: Pagers and Iterators

[prev] [thread] [next] [Date index for 2005/02/25]

From: Carl Johnstone
Subject: Re: Pagers and Iterators
Date: 13:23 on 25 Feb 2005
> Not really. The munging is actually a live calculation. Sorry, I should
> really have been much clearer when I simplified the example.
>
> The easiest thing I could think of would be to create a new
> Class::DBI::Iterator but the new method of that does not look designed
> to be called manually.

If you need to calculate something for each row to be able to sort, you're 
not going to save yourself anything by using an iterator - you'll already 
have created objects for every row in the DB.

As far as getting your paging working correctly, use Data::Page directly:

  my $page = Data::Page->new($total_entries, $entries_per_page, 
$current_page);

  my @sorted = sort { $a->foo cmp $b->foo } Class->retrieve_all
  my @wanted = $page->splice(\@sorted);



Carl

(message missing)

Pagers and Iterators
Simon Wistow 11:30 on 25 Feb 2005

Re: Pagers and Iterators
Daniel Wijnands 11:34 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 11:47 on 25 Feb 2005

Re: Pagers and Iterators
Sean Davis 11:55 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 12:14 on 25 Feb 2005

Re: Pagers and Iterators
Carl Johnstone 13:23 on 25 Feb 2005

Re: Pagers and Iterators
Cees Hek 14:18 on 25 Feb 2005

Re: Pagers and Iterators
Matt S Trout 14:35 on 25 Feb 2005

Re: Pagers and Iterators
William Ross 12:15 on 25 Feb 2005

Re: Pagers and Iterators
William Ross 14:04 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 15:37 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 16:34 on 25 Feb 2005

Re: Pagers and Iterators
Ofer Nave 20:52 on 25 Feb 2005

Re: Pagers and Iterators
Cees Hek 16:41 on 25 Feb 2005

Re: Pagers and Iterators
Carl Johnstone 17:09 on 25 Feb 2005

Generated at 17:56 on 01 Mar 2005 by mariachi v0.52