From: Matt S Trout Date: Fri, 30 Dec 2005 05:21:45 +0000 (+0000) Subject: Probably avoids some potential page/search bugs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=93b004d38c01cbc49fb83bf16ec628dd6898cbb9;p=dbsrgits%2FDBIx-Class-Historic.git Probably avoids some potential page/search bugs --- diff --git a/lib/DBIx/Class/CDBICompat/Pager.pm b/lib/DBIx/Class/CDBICompat/Pager.pm index a2099aa..c3d773c 100644 --- a/lib/DBIx/Class/CDBICompat/Pager.pm +++ b/lib/DBIx/Class/CDBICompat/Pager.pm @@ -9,7 +9,7 @@ sub page { my $class = shift; my $rs = $class->search(@_); - unless ($rs->{attrs}{page}) { + unless ($rs->{page}) { $rs = $rs->page(1); } return ( $rs->pager, $rs ); diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 340e4c5..6364054 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -79,10 +79,10 @@ sub new { cond => $attrs->{where}, from => $attrs->{from}, count => undef, + page => delete $attrs->{page}, pager => undef, attrs => $attrs }; bless ($new, $class); - #$new->pager if $attrs->{page}; return $new; } @@ -339,11 +339,11 @@ sense for queries with page turned on. sub pager { my ($self) = @_; my $attrs = $self->{attrs}; - die "Can't create pager for non-paged rs" unless $attrs->{page}; + die "Can't create pager for non-paged rs" unless $self->{page}; $attrs->{rows} ||= 10; $self->count; return $self->{pager} ||= Data::Page->new( - $self->{count}, $attrs->{rows}, $attrs->{page}); + $self->{count}, $attrs->{rows}, $self->{page}); } =head2 page($page_num)