Still having a problem with Pager when I return a ref to an array of
hashes from the get data sub.

It seems to work fine *except* when the number of rows returned for a
page is less than the page_size option. (usually the final page or the
initial page for a very small data set)

Pager returns:
get_data_callback returned something that isn't an array ref!  
You must return from get_data_callback in the format 
[ [ $col1, $col2], [ $col1, $col2] ] or 
[ { NAME => value ... }, { NAME => value ...} ]. 
at /usr/local/lib/perl5/site_perl/5.6.1/HTML/Pager.pm line 421.

Any ideas?


Here is the code I am using:

...

push (@loop, \%row);

my $rows = @loop;

my $template = HTML::Template->new(filename => 'category.tmpl',
                                       path => [ $tmpl_path,] );

$template->param(category => $category,
                 bag      => $bag,
                 );

my $get_data_sub = sub {
    my ($offset, $rows) = @_;
    my @return_array;
    for (my $x = 0; $x < $rows; $x++) {
    push(@return_array, $loop[$offset + $x] );
    }
return \@return_array;
};

my $pager = HTML::Pager->new(query => $q,
                             get_data_callback => $get_data_sub,
                             rows => $rows,
                             page_size => 10,
                             template => $template,
#                            debug => 1,
                            );

print $pager->output;


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to