[Catalyst] DBIx::Class/TT Pager Question

Brandon Black blblack at gmail.com
Fri Dec 29 17:31:23 GMT 2006


On 12/29/06, Chisel Wright <chisel at herlpacker.co.uk> wrote:
> On Fri, Dec 29, 2006 at 08:35:34AM -0800, Dennis Daupert wrote:
> >        $c->stash->{photos} = [$c->model('CatapultDB::Photos')->search(
> ...
> >        )];
> >
> >    $c->stash->{pager} => $c->stash->{photos}->pager(); # ???
>
> I think you need to lose the square brackets, and you will probably find
> you then have a DBIx::Class::ResultSet, which does have the pager()
> method.
>
> I can't remember what [$c->model(...)->search(...)] returns but I don't
> think you get a ResultSet object.
>

[$c->model(...)->search(...)] evaluates to a reference to an array of
result objects, on which one could do things like:

foreach my $result (@$arrayref_from_above) {
    print "This result has a PK of " . $result->id . "\n";
}



More information about the Catalyst mailing list