Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: DBIx::Class Pagination troubles

by fmerges (Chaplain)
on Sep 30, 2006 at 00:05 UTC ( [id://575627]=note: print w/replies, xml ) Need Help??


in reply to DBIx::Class Pagination troubles

Hi,

Every method on DBIx::Class where you want to pass additional options you do it after declaring an empty hashref... search({},{options...}).

Another thing..., I suggest you to doing thinks a lil' bit cleaner, less problems...

my $page = $q->param('page') || 1; my $rows = $q->param('rows') || 10; my $order_by = $q->param('order') || 'date DESC'; # And you should check, untaint the data, before using, # even an option like page= ... # Your code for getting the comments could be written as my $rs = $schema-> .... # and then while (my $comment = $rs->next) { ... } # this way, less memory is getting used by perl # Why not say my $pager = $rs->pager; # instead of this $rs->pager->...

Regards,

fmerges at irc.freenode.net

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://575627]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-03-28 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found