| DBIx-Class-ResultSet-Data-Pageset documentation | Contained in the DBIx-Class-ResultSet-Data-Pageset distribution. |
DBIx::Class::ResultSet::Data::Pageset - Get a Data::Pageset pager from a resultset
# in your resultsource class
__PACKAGE__->resultset_class( 'DBIx::Class::ResultSet::Data::Pageset' );
# in your calling code
my $rs = $schema->resultset('Foo')->search( { }, { pages_per_set => 5 } );
my $pager = $rs->pageset;
# sliding pager
my $rs2 = $schema->resultset('Foo')->search( { }, { pageset_mode => 'slide' } );
This is a simple way to allow you to get a Data::Pageset object for paging rather than the standard Data::Page object.
perl Makefile.PL
make
make test
make install
Returns a Data::Pageset object for paging. This will grab the pages_per_set
option (default: 10) and the pageset_mode option (default: fixed) from the
resultset attributes.
Brian Cassidy <bricas@cpan.org>
Copyright 2007-2009 by Brian Cassidy
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| DBIx-Class-ResultSet-Data-Pageset documentation | Contained in the DBIx-Class-ResultSet-Data-Pageset distribution. |
package DBIx::Class::ResultSet::Data::Pageset; use strict; use warnings; use base qw( DBIx::Class::ResultSet ); use Data::Pageset (); our $VERSION = '0.06';
sub pageset { my( $self ) = @_; my $pager = $self->pager; my $attrs = $self->{attrs}; return Data::Pageset->new( { ( map { $_ => $pager->$_ } qw( entries_per_page total_entries current_page ), ), pages_per_set => $attrs->{ pages_per_set } || 10, mode => $attrs->{ pageset_mode } || 'fixed', } ); }
1;