Articles Tagged: cpan

Get Lazy, Use Data::Pageset::Render June 04, 2009

I have been using the very nice Data::Pageset module for a while now. It makes separating you data into multiple pages very simple, and for very large datasets it has the slide mode which helps keep your pager small (rather than have links to 100 pages, you get links to the first and last page and the five pages around your current page).

Eventually, I got tired of recreating the same html code for each new pager. I first put together a simple Mason component, but found myself copying it between projects and starting to write one for TT. Eventually, I wrote Data::Pageset::Render. The module (which is on CPAN) subclasses Data::Pageset and adds the html method, which returns the html code, complete with links, to create your pager.

Just create your pager object as you would with Data::Pageset adding link_format => '<a href="#">%a</a>' to the constructor, the html method then eliminates all that redundant paging html.

More...

License

The contents of this blog are licensed under the Creative Commons “Attribution-Noncommercial-Share Alike 3.0″ license.