X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FCDBICompat%2FPager.pm;h=c8f76feee0349b906569d16b94ef0ffbe41d5c0c;hb=5e0eea3522876a30453af24097507198bbbc9409;hp=ea53529f02bd13c3298d1e40938d6131290bdc71;hpb=3c5b25c5328c41ff6fb062bf2aed446263cf01ec;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/CDBICompat/Pager.pm b/lib/DBIx/Class/CDBICompat/Pager.pm index ea53529..c8f76fe 100644 --- a/lib/DBIx/Class/CDBICompat/Pager.pm +++ b/lib/DBIx/Class/CDBICompat/Pager.pm @@ -1,15 +1,25 @@ -package DBIx::Class::CDBICompat::Pager; - -use strict; -use warnings FATAL => 'all'; - -*pager = \&page; - -sub page { - my $class = shift; - - my $it = $class->search(@_); - return ( $it->pager, $it ); -} - -1; +package # hide from PAUSE + DBIx::Class::CDBICompat::Pager; + +use strict; + +# even though fatalization has been proven over and over to be a universally +# bad idea, this line has been part of the code from the beginning +# leaving the compat layer as-is, something may in fact depend on that +use warnings FATAL => 'all'; + +use base 'DBIx::Class'; + +*pager = \&page; + +sub page { + my $class = shift; + + my $rs = $class->search(@_); + unless ($rs->{attrs}{page}) { + $rs = $rs->page(1); + } + return ( $rs->pager, $rs ); +} + +1;