Stray Taoist > Data-Pageset-Variable-0.03 > Data::Pageset::Variable

Download:
Data-Pageset-Variable-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Data::Pageset::Variable - Variable results on each page of results.

SYNOPSIS ^

        use Data::Pageset::Variable;
                # As Data::Pageset except...

        my $page_info = Data::Pageset->new(
                { 
                        total_entries              => $total_entries, 
                        variable_entries_per_page  => { 1 => 30, 2 => 20, 3 => 10, } 
                        entries_per_page           => 10,
                }
        );

DESCRIPTION ^

Data::Pageset is A Great Module, and totally useful. This is a subclass that extends its behaviour.

Data::Pageset returns an object with a set number of pages per set. The point of Data::Pageset::Variable is that you might not want this to be so. You might, for reasons best known to yourself, want to have twice the number of results on the first page as on the second, and so on.

So now you can!

HAIKU ^

 Different numbers
 Of results on each page helps
 Tabulate results

This arose as Tony (http://www.tmtm.com/nothing/) suggested to me that if I can't write the documentation of a module in haiku, then it is doing too many things. As I (also) believe that modules should be responsible for one concept, and one only.

Also, I have no poetical ability, so forgive my clumsy attempt.

METHODS ^

variable_entries_per_page

        # In the constructor hashref...
                variable_entries_per_page => { 1 => 30, 2 => 20, 3 => 10, },

The variable_entries_per_page argument takes a hashref.

The key/value pairs of this hashref are the pages and the number of entries on the page. If there is a page for which none is specified, then we use the value of default_entries_per_page.

If this isn't set, then we behave exactly like Data::Pageset.

entries_per_page

        # In the constructor hashref...  
                entries_per_page => 10,

This must be set. It is not optional. This is the number of entries per page for all pages which aren't specified in the entries_per_page hashref.

SHOWING YOU APPRECIATION ^

There was a thread on london.pm mailing list about working in a vacumn - that it was a bit depressing to keep writing modules but never get any feedback. So, if you use and like this module then please send me an email and make my day.

All it takes is a few little bytes.

(Leon wrote that, not me!)

AUTHOR ^

Stray Toaster, <coder@stray-toaster.co.uk>

With Thanks

Leo for Data::Pageset. It rocks. (And also for a code suggestion, and taking the time to even look at this!)

COPYRIGHT AND LICENSE ^

Copyright 2003 by Stray Toaster

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: