[Dbix-class] Per the design of a method

dorian taylor dorian.taylor.lists at gmail.com
Thu Jun 16 17:27:08 GMT 2011


On Thu, Jun 16, 2011 at 10:17 AM, Peter Rabbitson <rabbit+dbic at rabbit.us> wrote:

> This won't be wrong - ->count returns how many objects you would receive
> via ->all/->next. If you want full count of the underlying source with
> all limits removed - keep the original resultset around. If you do not care
> about WHERE conditions either - $rs->result_source->resultset->count will
> do it for you.

Except it is wrong:

my $rs = $db->resultset('Employee::Job')->search(
    { period => '2010-02-28' },
    {
        rows => 100,
        offset => 100,
    }
);

print $rs->count; # 100, the number I'm looking for is 2023

So what it looks like I want to do is like you suggested, clone the
ResultSet and either get the WHERE clause out of the original or
remove the rows/offset attributes and/or add them in later. I just
don't see anything in the class's interface that will let me do that.

Thanks,

-- 
Dorian Taylor
http://doriantaylor.com/



More information about the DBIx-Class mailing list