File Coverage

lib/DBIx/Skinny/Mixin/SearchWithPager.pm
Criterion Covered Total %
statement 10 19 52.6
branch 0 4 0.0
condition n/a
subroutine 4 5 80.0
pod 0 2 0.0
total 14 30 46.6


line stmt bran cond sub pod time code
1             package DBIx::Skinny::Mixin::SearchWithPager;
2 3     3   3116 use strict;
  3         5  
  3         90  
3 3     3   14 use warnings;
  3         3  
  3         65  
4 3     3   15 use UNIVERSAL::require;
  3         5  
  3         17  
5              
6             sub register_method {
7             +{
8 2     2 0 50 'search_with_pager' => \&search_with_pager,
9             };
10             }
11              
12             sub search_with_pager {
13 0     0 0   my ($class, $table, $where_cnd, $option_cnd, ) = @_;
14 0           my $pager_logic = delete $option_cnd->{pager_logic};
15 0           my $page = delete $option_cnd->{page};
16 0           my $rs = $class->search_rs($table, $where_cnd, $option_cnd);
17 0           my $logic_class = "DBIx::Skinny::Pager::Logic::$pager_logic";
18 0 0         $logic_class->require
19             or die $@;
20 0           bless $rs, $logic_class; # rebless resultset.
21 0 0         $rs->page($page) if $page;
22 0           $rs->retrieve();
23             }
24              
25             1;
26              
27             __END__