File Coverage

blib/lib/Data/Paginate.pm
Criterion Covered Total %
statement 21 428 4.9
branch 0 310 0.0
condition 0 156 0.0
subroutine 7 48 14.5
pod 9 29 31.0
total 37 971 3.8


\n$indent$indent$indent\n$indent$indent\n$start); \n$indent$indent$indent\n$indent$indent\n); '; \n); \n); \n); or only show pages_in_set amount???)
line stmt bran cond sub pod time code
1             package Data::Paginate;
2              
3 1     1   57973 use strict;
  1         4  
  1         43  
4 1     1   5 use warnings;
  1         2  
  1         28  
5 1     1   954 use version;our $VERSION = qv('0.0.6');
  1         2275  
  1         6  
6              
7 1     1   105 use Carp ();
  1         1  
  1         16  
8 1     1   965 use POSIX ();
  1         8127  
  1         31  
9 1     1   1487 use Class::Std;
  1         15505  
  1         8  
10 1     1   1090 use Class::Std::Utils;
  1         716  
  1         7  
11              
12             sub croak {
13 0     0 0   local $Carp::CarpLevel = $Carp::CarpLevel + 1;
14 0           Carp::croak(@_);
15             }
16              
17             sub carp {
18 0     0 0   local $Carp::CarpLevel = $Carp::CarpLevel + 1;
19 0           Carp::carp(@_);
20             }
21              
22             { #### begin scoping "inside-out" class ##
23            
24             #### manually set_ because they recalculate ##
25             #### needs manually set in BUILD ##
26              
27             my %total_entries :ATTR('get' => 'total_entries', 'default' => '100');
28             sub set_total_entries {
29 0     0 0   my ($self, $digit, $checkonly) = @_;
30 0           my $reftype = ref $digit;
31              
32 0 0 0       carp('Argument to set_total_entries() must be a digit or an array ref') && return if $digit !~ m/^\d+$/ && $reftype ne 'ARRAY';
      0        
33 0 0         return 1 if $checkonly;
34 0 0         $total_entries{ ident $self } = $reftype eq 'ARRAY' ? @{ $digit }
  0            
35             : $digit;
36 0           $self->_calculate();
37             }
38              
39             my %entries_per_page :ATTR('get' => 'entries_per_page', 'default' => '10');
40             sub set_entries_per_page {
41 0     0 0   my ($self, $digit, $checkonly) = @_;
42 0 0 0       carp('Argument to set_entries_per_page() must be a digit') && return
43             if $digit !~ m/^\d+$/;
44 0 0         return 1 if $checkonly;
45 0           $entries_per_page{ ident $self } = $digit;
46 0           $self->_calculate();
47             }
48              
49             my %pages_per_set :ATTR('get' => 'pages_per_set', 'default' => '10');
50             sub set_pages_per_set {
51 0     0 0   my ($self, $digit, $checkonly) = @_;
52 0 0 0       carp('Argument to set_pages_per_set() must be a digit') && return
53             if $digit !~ m/^\d+$/;
54 0 0         return 1 if $checkonly;
55 0           $pages_per_set{ ident $self } = $digit;
56 0           $self->_calculate();
57             }
58            
59             my %sets_per_set :ATTR('get' => 'sets_per_set', 'default' => '10');
60             sub set_sets_per_set {
61 0     0 0   my ($self, $digit, $checkonly) = @_;
62 0 0 0       carp('Argument to set_sets_per_set() must be a digit') && return
63             if $digit !~ m/^\d+$/;
64 0 0         return 1 if $checkonly;
65 0           $sets_per_set{ ident $self } = $digit;
66 0           $self->_calculate();
67             }
68              
69             my %current_page :ATTR('get' => 'current_page', 'default' => '1');
70             sub _set_current_page {
71 0     0     my ($self, $digit, $checkonly) = @_;
72 0 0 0       carp('Argument to _set_current_page() must be a digit') && return
73             if $digit !~ m/^\d+$/;
74 0 0         return 1 if $checkonly;
75 0           $current_page{ ident $self } = $digit;
76 0           $self->_calculate();
77             }
78              
79             my %variable_entries_per_page :ATTR('get' => 'variable_entries_per_page', 'default' => {});
80             sub set_variable_entries_per_page {
81 0     0 0   my ($self, $hashref, $checkonly) = @_;
82 0 0 0       carp('Argument to set_variable_entries_per_page() must be a hashref') && return
83             if ref $hashref ne 'HASH';
84 0           for(keys %{ $hashref }) {
  0            
85 0 0 0       carp('Non digit key in set_variable_entries_per_page() arg') && return
86             if $_ !~ m/^\d+$/;
87 0 0 0       carp("Non digit value in set_variable_entries_per_page() arg $_") && return
88             if $hashref->{$_} !~ m/^\d+$/;
89             }
90 0 0         return 1 if $checkonly;
91 0           $variable_entries_per_page{ ident $self } = $hashref;
92 0           $self->_calculate();
93             }
94              
95             #### manually set_ because they need input checked ##
96             #### needs manually set in BUILD ##
97              
98             my %ext_obj :ATTR('get' => 'ext_obj');
99             sub set_ext_obj {
100 0     0 0   my ($self, $obj) = @_;
101 0 0 0       carp('Argument to set_ext_obj() must be an object') && return
102             if !ref $obj;
103 0           $ext_obj{ ident $self } = $obj;
104             }
105            
106             my %page_result_display_map :ATTR('get' => 'page_result_display_map', 'default' => {});
107             sub set_page_result_display_map {
108 0     0 0   my ($self, $hashref) = @_;
109 0 0 0       carp('Argument to set_page_result_display_map() must be a hashref') && return
110             if ref $hashref ne 'HASH';
111 0           $page_result_display_map{ ident $self } = $hashref;
112             }
113              
114             my %set_result_display_map :ATTR('get' => 'set_result_display_map', 'default' => {});
115             sub set_set_result_display_map {
116 0     0 0   my ($self, $hashref) = @_;
117 0 0 0       carp('Argument to set_result_display_map() must be a hashref') && return
118             if ref $hashref ne 'HASH';
119 0           $set_result_display_map{ ident $self } = $hashref;
120             }
121              
122             my %result_display_map :ATTR; # set 2 above, no get_:
123             sub set_result_display_map {
124 0     0 1   my ($self, $hashref) = @_;
125 0 0 0       carp('Argument to set_result_display_map() must be a hashref') && return
126             if ref $hashref ne 'HASH';
127 0           $page_result_display_map{ ident $self } = $hashref;
128 0           $set_result_display_map{ ident $self } = $hashref;
129             }
130              
131             my %html_line_white_space :ATTR('get' => 'html_line_white_space', 'default' => '0');
132             sub set_html_line_white_space {
133 0     0 0   my ($self, $digit) = @_;
134 0 0 0       carp('Argument to set_html_line_white_space() must be a digit') && return
135             if $digit !~ m/^\d+$/;
136 0           $html_line_white_space{ ident $self } = $digit;
137             }
138              
139             my %param_handler :ATTR('get' => 'param_handler', 'default' => undef);
140             sub set_param_handler {
141 0     0 0   my ($self, $coderef) = @_;
142 0 0 0       carp('Argument to set_param_handler() must be a code ref') && return
143             if ref $coderef ne 'CODE';
144 0           $param_handler{ ident $self } = $coderef;
145             }
146              
147             my %sets_in_rows :ATTR('get' => 'sets_in_rows', 'default' => '0');
148             sub set_sets_in_rows {
149 0     0 0   my ($self, $digit) = @_;
150 0 0 0       carp('Argument to set_sets_in_rows() must be a digit') && return
151             if $digit !~ m/^\d+$/;
152 0           $sets_in_rows{ ident $self } = $digit;
153             }
154              
155             #### get_ only since these are set only by _calulate() is done ##
156              
157             my %entries_on_this_page :ATTR('get' => 'entries_on_this_page');
158             my %first_page :ATTR('get' => 'first_page');
159             my %last_page :ATTR('get' => 'last_page');
160             my %first :ATTR('get' => 'first');
161             my %last :ATTR('get' => 'last');
162             my %previous_page :ATTR('get' => 'previous_page');
163             my %next_page :ATTR('get' => 'next_page');
164              
165             my %previous_set :ATTR('get' => 'previous_set');
166             my %next_set :ATTR('get' => 'next_set');
167             my %pages_in_set :ATTR('get' => 'pages_in_set');
168              
169             my %last_set :ATTR('get' => 'last_set');
170             my %first_set :ATTR('get' => 'first_set');
171             my %last_page_in_set :ATTR('get' => 'last_page_in_set');
172             my %first_page_in_set :ATTR('get' => 'first_page_in_set');
173             my %last_set_in_set :ATTR('get' => 'last_set_in_set');
174             my %first_set_in_set :ATTR('get' => 'first_set_in_set');
175             my %current_set :ATTR('get' => 'current_set');
176              
177             #### manually get_ only because they require handling ##
178              
179             sub get_pages_range {
180 0     0 1   my ($self) = @_;
181 0           return ($first{ ident $self } - 1 .. $last{ ident $self } - 1);
182             }
183              
184             sub get_pages_splice {
185 0     0 1   my($self, $arrayref) = @_;
186 0           return @{ $arrayref }[ $self->get_pages_range() ];
  0            
187             }
188              
189             sub get_pages_splice_ref {
190 0     0 1   my($self, $arrayref) = @_;
191 0           return [ $self->get_pages_splice($arrayref) ];
192             }
193              
194             sub get_firstlast {
195 0     0 1   my ($self) = @_;
196 0 0         return ($first{ ident $self }, $last{ ident $self }) if wantarray;
197 0           return "$first{ ident $self },$last{ ident $self }";
198             }
199              
200             sub get_lastfirst {
201 0     0 1   my ($self) = @_;
202 0 0         return ($last{ ident $self }, $first{ ident $self }) if wantarray;
203 0           return "$last{ ident $self },$first{ ident $self }";
204             }
205              
206             sub get_state_hashref {
207 0     0 1   my ($self) = @_;
208 0           my $hashref = eval $self->_DUMP();
209 0           return $hashref->{ ref $self };
210             }
211            
212             sub get_state_html {
213 0     0 0   my ($self) = @_;
214 0           require Data::Dumper::HTML;
215 0 0         return Data::Dumper::HTML::dumper_html( $self->get_state_hashref() ) if defined wantarray;
216 0           print Data::Dumper::HTML::dumper_html( $self->get_state_hashref() );
217             }
218              
219             #### get_ and set_ ##
220              
221             #### no default, handle in BUILD since it chokes on '&'
222             my %pre_current_page :ATTR('get' => 'pre_current_page', 'set' => 'pre_current_page', 'init_arg' => 'pre_current_page');
223             my %pst_current_page :ATTR('get' => 'pst_current_page', 'set' => 'pst_current_page', 'init_arg' => 'pst_current_page');
224             my %pst_current_set :ATTR('get' => 'pst_current_set', 'set' => 'pst_current_set', 'init_arg' => 'pst_current_set');
225             my %pre_current_set :ATTR('get' => 'pre_current_set', 'set' => 'pre_current_set', 'init_arg' => 'pre_current_set');
226              
227             my %total_entries_param :ATTR('get' => 'total_entries_param', 'set' => 'total_entries_param', 'default' => 'te', 'init_arg' => 'total_entries_param');
228             my %total_entries_verify_param_name :ATTR('get' => 'total_entries_verify_param_name', 'set' => 'total_entries_verify_param_name', 'default' => 've', 'init_arg' => 'total_entries_param_verify_name');
229             my %total_entries_verify_param_value :ATTR('get' => 'total_entries_verify_param_value', 'set' => 'total_entries_verify_param_value', 'default' => '', 'init_arg' => 'total_entries_param_verify_value');
230             my %set_param :ATTR('get' => 'set_param', 'set' => 'set_param', 'default' => 'st', 'init_arg' => 'set_param');
231             my %next_page_html :ATTR('get' => 'next_page_html', 'set' => 'next_page_html', 'default' => 'Next Page →', 'init_arg' => 'next_page_html');
232             my %page_param :ATTR('get' => 'page_param', 'set' => 'page_param', 'default' => 'pg', 'init_arg' => 'page_param');
233             my %simple_nav :ATTR('get' => 'simple_nav', 'set' => 'simple_nav', 'default' => '0', 'init_arg' => 'simple_nav');
234             my %cssid_set :ATTR('get' => 'cssid_set', 'set' => 'cssid_set', 'default' => 'set', 'init_arg' => 'cssid_set');
235             my %cssid_not_current_page :ATTR('get' => 'cssid_not_current_page', 'set' => 'cssid_not_current_page', 'default' => 'notpg', 'init_arg' => 'cssid_not_current_page');
236             my %cssid_current_set :ATTR('get' => 'cssid_current_set', 'set' => 'cssid_current_set', 'default' => 'curst', 'init_arg' => 'cssid_current_set');
237             my %pre_not_current_set :ATTR('get' => 'pre_not_current_set', 'set' => 'pre_not_current_set', 'default' => '[', 'init_arg' => 'pre_not_current_set');
238             my %pre_not_current_page :ATTR('get' => 'pre_not_current_page', 'set' => 'pre_not_current_page', 'default' => '[', 'init_arg' => 'pre_not_current_page');
239             my %pst_not_current_set :ATTR('get' => 'pst_not_current_set', 'set' => 'pst_not_current_set', 'default' => ']', 'init_arg' => 'pst_not_current_set');
240             my %prev_set_html :ATTR('get' => 'prev_set_html', 'set' => 'prev_set_html', 'default' => '← Prev Set', 'init_arg' => 'prev_set_html');
241             my %one_set_hide :ATTR('get' => 'one_set_hide', 'set' => 'one_set_hide', 'default' => '0', 'init_arg' => 'one_set_hide');
242             my %no_prev_set_html :ATTR('get' => 'no_prev_set_html', 'set' => 'no_prev_set_html', 'default' => '', 'init_arg' => 'no_prev_set_html');
243             my %as_table :ATTR('get' => 'as_table', 'set' => 'as_table', 'default' => '0', 'init_arg' => 'as_table');
244             my %pst_not_current_page :ATTR('get' => 'pst_not_current_page', 'set' => 'pst_not_current_page', 'default' => ']', 'init_arg' => 'pst_not_current_page');
245             my %style :ATTR('get' => 'style', 'set' => 'style', 'init_arg' => 'style');
246             my %no_prev_page_html :ATTR('get' => 'no_prev_page_html', 'set' => 'no_prev_page_html', 'default' => '', 'init_arg' => 'no_prev_page_html');
247             my %one_page_hide :ATTR('get' => 'one_page_hide', 'set' => 'one_page_hide', 'default' => '0', 'init_arg' => 'one_page_hide');
248             my %next_set_html :ATTR('get' => 'next_set_html', 'set' => 'next_set_html', 'default' => 'Next Set →', 'init_arg' => 'next_set_html');
249             my %one_set_html :ATTR('get' => 'one_set_html', 'set' => 'one_set_html', 'default' => '', 'init_arg' => 'one_set_html');
250             my %no_next_page_html :ATTR('get' => 'no_next_page_html', 'set' => 'no_next_page_html', 'default' => '', 'init_arg' => 'no_next_page_html');
251             my %cssid_current_page :ATTR('get' => 'cssid_current_page', 'set' => 'cssid_current_page', 'default' => 'curpg', 'init_arg' => 'cssid_current_page');
252             my %no_next_set_html :ATTR('get' => 'no_next_set_html', 'set' => 'no_next_set_html', 'default' => '', 'init_arg' => 'no_next_set_html');
253             my %prev_page_html :ATTR('get' => 'prev_page_html', 'set' => 'prev_page_html', 'default' => '← Prev Page', 'init_arg' => 'prev_page_html');
254             my %cssid_page :ATTR('get' => 'cssid_page', 'set' => 'cssid_page', 'default' => 'page', 'init_arg' => 'cssid_page');
255             my %cssid_not_current_set :ATTR('get' => 'cssid_not_current_set', 'set' => 'cssid_not_current_set', 'default' => 'notst', 'init_arg' => 'cssid_not_current_set');
256             my %use_of_vars :ATTR('get' => 'use_of_vars', 'set' => 'use_of_vars', 'default' => '0', 'init_arg' => 'use_of_vars');
257             my %one_page_html :ATTR('get' => 'one_page_html', 'set' => 'one_page_html', 'default' => '', 'init_arg' => 'one_page_html');
258              
259             my %of_page_string :ATTR('get' => 'of_page_string', 'set' => 'of_page_string', 'default' => 'Page', 'init_arg' => 'of_page_string');
260             my %of_set_string :ATTR('get' => 'of_set_string', 'set' => 'of_set_string', 'default' => 'Set', 'init_arg' => 'of_set_string');
261             my %of_of_string :ATTR('get' => 'of_of_string', 'set' => 'of_of_string', 'default' => 'of', 'init_arg' => 'of_of_string');
262             my %of_page_html :ATTR('get' => 'of_page_html', 'set' => 'of_page_html', 'default' => '', 'init_arg' => 'of_page_html');
263             my %of_set_html :ATTR('get' => 'of_set_html', 'set' => 'of_set_html', 'default' => '', 'init_arg' => 'of_set_html');
264              
265             my %data_html_config :ATTR('get' => 'data_html_config', 'init_arg' => 'data_html_config');
266             my %perpage_html_config :ATTR('get' => 'perpage_html_config', 'init_arg' => 'perpage_html_config');
267            
268             sub _calculate {
269 0     0     my ($self) = @_;
270 0           my $ident = ident $self;
271              
272 0 0 0       $current_page{$ident} = ((($current_set{$ident} - 1) * $pages_per_set{$ident}) + 1)
      0        
273             if defined $current_set{$ident} && $current_set{$ident} =~ m/^\d+$/ && $current_set{$ident} > 0;
274              
275 0           $first_page_in_set{$ident} = 0; # set to 0 so its numeric
276 0           $last_page_in_set{$ident} = 0; # set to 0 so its numeric
277              
278 0 0         my $per_page = exists $variable_entries_per_page{$ident}->{ $current_page{$ident} }
279             ? $variable_entries_per_page{$ident}->{ $current_page{$ident} } : $entries_per_page{$ident};
280              
281 0           my ($p,$r) = (0,0);
282 0           for(keys %{ $variable_entries_per_page{$ident} }) {
  0            
283 0 0         if($variable_entries_per_page{$ident}->{$_} =~ m/^\d+$/) {
284 0           $p++;
285 0           $r += int($variable_entries_per_page{$ident}->{$_});
286             }
287             }
288              
289 0           ($first_page{$ident}, $first{$ident}, $last{$ident}) = (1,0,0);
290 0           $last_page{$ident} = POSIX::ceil($p + (($total_entries{$ident} - $r) / $entries_per_page{$ident}));
291 0 0         $current_page{$ident} = $last_page{$ident} if $current_page{$ident} > $last_page{$ident};
292              
293 0           for($first_page{$ident} .. $current_page{$ident}) {
294 0 0 0       if($current_page{$ident} == $last_page{$ident} && $_ == $current_page{$ident}) {
295 0           $first{$ident} = $last{$ident} + 1;
296 0           $last{$ident} += $total_entries{$ident} - $last{$ident};
297             }
298             else {
299 0 0         $last{$ident} += exists $variable_entries_per_page{$ident}->{$_}
300             ? $variable_entries_per_page{$ident}->{$_} : $entries_per_page{$ident};
301             }
302             }
303              
304 0 0         $first{$ident} = $last{$ident} - ($per_page - 1) if !$first{$ident};
305 0           $previous_page{$ident} = $current_page{$ident} - 1;
306 0 0         $next_page{$ident} = (($current_page{$ident} + 1) <= $last_page{$ident}) ? $current_page{$ident} + 1 : 0 ;
307 0           $entries_on_this_page{$ident} = ($last{$ident} - $first{$ident}) + 1;
308              
309 0 0         $of_page_string{$ident} = 'Page' unless defined $of_page_string{$ident}; # why do we need this hack, what make Class::Std miss it ??
310 0 0         $of_of_string{$ident} = 'of' unless defined $of_of_string{$ident}; # why do we need this hack, what make Class::Std miss it ??
311 0           $of_page_html{$ident} = "$of_page_string{$ident} $current_page{$ident} $of_of_string{$ident} $last_page{$ident}";
312              
313 0 0 0       if($pages_per_set{$ident} =~ m/^\d+$/ && $pages_per_set{$ident} > 0) {
314 0           $last_set{$ident} = POSIX::ceil($last_page{$ident} / $pages_per_set{$ident});
315 0 0 0       $current_set{$ident} = POSIX::ceil($current_page{$ident} / $pages_per_set{$ident})
      0        
316             unless defined $current_set{$ident} && $current_set{$ident} =~ m/^\d+$/ && $current_set{$ident} > 0;
317 0 0         $current_set{$ident} = $last_set{$ident} if $current_set{$ident} > $last_set{$ident};
318 0           $first_page_in_set{$ident} = (($current_set{$ident} - 1) * $pages_per_set{$ident}) + 1;
319 0           $last_page_in_set{$ident} = ($first_page_in_set{$ident} + $pages_per_set{$ident}) - 1;
320            
321 0           $first_set{$ident} = 1;
322            
323 0           my $floor = POSIX::floor($current_set{$ident}/$sets_per_set{$ident});
324 0           my $floor_cmp = $current_set{$ident}/$sets_per_set{$ident};
325 0           $first_set_in_set{$ident} = ($floor * $sets_per_set{$ident});
326 0 0 0       if($floor == $floor_cmp && $first_set_in_set{$ident} > 1) {
327 0           $first_set_in_set{$ident} -= $sets_per_set{$ident};
328 0 0         $first_set_in_set{$ident} += 1 if $first_set_in_set{$ident} > 1;
329             }
330             else {
331 0 0         $first_set_in_set{$ident} += 1 if $first_set_in_set{$ident} > 1;
332             }
333 0           $last_set_in_set{$ident} = ($first_set_in_set{$ident} + $sets_per_set{$ident});
334 0 0         $last_set_in_set{$ident} -= 1 if $first_set_in_set{$ident} > 1;
335 0 0         $last_set_in_set{$ident} = $last_set{$ident} if $last_set_in_set{$ident} > $last_set{$ident};
336            
337 0           $previous_set{$ident} = $current_set{$ident} - 1;
338 0 0         $next_set{$ident} = (($current_set{$ident} + 1) <= $last_set{$ident}) ? $current_set{$ident} + 1 : 0 ;
339 0 0         $pages_in_set{$ident} = $current_set{$ident} == $last_set{$ident}
340             ? $total_entries{$ident} - (($last_set{$ident} - 1) * $pages_per_set{$ident}) : $pages_per_set{$ident};
341              
342 0 0         $of_set_string{$ident} = 'Set' unless defined $of_set_string{$ident}; # why do we need this hack, what make Class::Std miss it ??
343 0           $of_set_html{$ident} = "$of_set_string{$ident} $current_set{$ident} $of_of_string{$ident} $last_set{$ident}";
344             }
345             }
346              
347             sub BUILD {
348 0     0 0   my ($self, $ident, $arg_ref) = @_;
349              
350             #### since ATTR: chokes on default => ' with an & escaped or not... ##
351 0 0         $pre_current_page{ $ident } = exists $arg_ref->{pre_current_set} ? $arg_ref->{pre_current_set} : q{»};
352 0 0         $pst_current_page{ $ident } = exists $arg_ref->{pst_current_page} ? $arg_ref->{pst_current_page} : q{«};
353 0 0         $pre_current_set{ $ident } = exists $arg_ref->{pre_current_set} ? $arg_ref->{pre_current_set} : q{»};
354 0 0         $pst_current_set{ $ident } = exists $arg_ref->{pst_current_set} ? $arg_ref->{pst_current_set} : q{«};
355              
356 0 0         $result_display_map{ $ident } = exists $arg_ref->{result_display_map} ? $arg_ref->{result_display_map} : {};
357 0 0         $page_result_display_map{ $ident } = exists $arg_ref->{page_result_display_map} ? $arg_ref->{page_result_display_map} : {};
358 0 0         $set_result_display_map{ $ident } = exists $arg_ref->{set_result_display_map} ? $arg_ref->{set_result_display_map} : {};
359              
360 0 0         $html_line_white_space{ $ident } = exists $arg_ref->{html_line_white_space} ? $arg_ref->{html_line_white_space} : 0;
361 0 0         $style{ $ident } = exists $arg_ref->{'style'} ? $arg_ref->{'style'} : $self->_default_style();
362              
363 0 0 0       $ext_obj{ $ident } = exists $arg_ref->{'ext_obj'} && ref $arg_ref->{'ext_obj'} ? $arg_ref->{'ext_obj'} : undef;
364 0 0         if(!defined $ext_obj{ $ident }) {
365 0           require CGI;
366 0           $ext_obj{ $ident } = CGI->new();
367             }
368            
369             $param_handler{ $ident } = exists $arg_ref->{param_handler}
370 0 0   0     ? exists $arg_ref->{param_handler} : sub { $ext_obj{ $ident }->param(@_);};
  0            
371 0 0         $sets_in_rows{ $ident } = exists $arg_ref->{sets_in_rows} ? $arg_ref->{sets_in_rows} : 0;
372              
373             #### $self->set_result_display_map( $result_display_map{ $ident } ); # this poofs the whole thing w/out error, why ?? ##
374 0           $self->set_page_result_display_map( $page_result_display_map{ $ident } );
375 0           $self->set_set_result_display_map( $set_result_display_map{ $ident } );
376 0           $self->set_html_line_white_space( $html_line_white_space{ $ident } );
377 0           $self->set_param_handler( $param_handler{ $ident } );
378 0           $self->set_sets_in_rows( $sets_in_rows{ $ident } );
379              
380 0 0 0       $total_entries{ $ident } = exists $arg_ref->{total_entries} ? $arg_ref->{total_entries}
381             : $param_handler{ $ident }->($total_entries_param{ $ident }) || 100;
382 0 0         $entries_per_page{ $ident } = exists $arg_ref->{entries_per_page} ? $arg_ref->{entries_per_page}
383             : 10; # param 'pp' ???
384 0 0         $pages_per_set{ $ident } = exists $arg_ref->{pages_per_set} ? $arg_ref->{pages_per_set} : 10;
385 0 0         $sets_per_set{ $ident } = exists $arg_ref->{sets_per_set} ? $arg_ref->{sets_per_set} : $pages_per_set{ $ident };
386            
387 0 0         $page_param{ $ident } = exists $arg_ref->{page_param} ? $arg_ref->{page_param} : 'pg';
388 0 0         $set_param{ $ident } = exists $arg_ref->{set_param} ? $arg_ref->{set_param} : 'st';
389 0 0         $total_entries_verify_param_name{ $ident } = exists $arg_ref->{total_entries_verify_param_name} ? $arg_ref->{total_entries_verify_param_name} : 've';
390 0 0         $total_entries_verify_param_value{ $ident } = exists $arg_ref->{total_entries_verify_param_value} ? $arg_ref->{total_entries_verify_param_value} : '';
391            
392 0           $current_page{ $ident } = 1;
393 0 0 0       if(!defined $arg_ref->{current_page} || $arg_ref->{current_page} !~ m/^\d+$/
      0        
394             || $arg_ref->{current_page} < 1) {
395 0           my $curpg = $param_handler{ $ident }->($page_param{ $ident });
396 0 0 0       $current_page{ $ident } = $curpg if defined $curpg
      0        
397             && $curpg =~ m/^\d+$/
398             && $curpg > 0;
399             }
400              
401 0 0 0       if(!defined $arg_ref->{current_set} || $arg_ref->{current_set} !~ m/^\d+$/
      0        
402             || $arg_ref->{current_set} < 1) {
403 0           my $curst = $param_handler{ $ident }->($set_param{ $ident });
404 0 0 0       $current_set{ $ident } = $curst if defined $curst
      0        
405             && $curst =~ m/^\d+$/
406             && $curst > 0;
407             }
408             # $current_page{ $ident } = exists $arg_ref->{current_page} ? $arg_ref->{current_page}
409             # : $param_handler{ $ident }->($page_param{ $ident }) || 1;
410             # $current_set{ $ident } = exists $arg_ref->{current_set} ? $arg_ref->{current_set}
411             # : $param_handler{ $ident }->($set_param{ $ident }) || 1;
412              
413 0 0         $variable_entries_per_page{ $ident } = exists $arg_ref->{variable_entries_per_page} ? $arg_ref->{variable_entries_per_page} : {};
414              
415             #### second true arg is undocumented for a reason, don't use it - ever ##
416 0           $self->set_total_entries( $total_entries{ $ident }, 1 );
417 0           $self->set_entries_per_page( $entries_per_page{ $ident }, 1 );
418 0           $self->set_pages_per_set( $pages_per_set{ $ident }, 1 );
419 0           $self->set_sets_per_set( $sets_per_set{ $ident }, 1 );
420 0           $self->_set_current_page( $current_page{ $ident }, 1 );
421 0           $self->set_variable_entries_per_page( $variable_entries_per_page{ $ident }, 1 );
422              
423             # set up defaults...
424             $data_html_config{ $ident } = {
425             'col_alt_ar' => ['data_col'],
426             'row_alt_ar' => [qw(data_light data_medium data_dark)],
427             'top' => sub {
428 0     0     my ($self, $indent) = @_;
429 0           my $ident = ident $self;
430 0           my $start = qq($indent\n); \n$indent$indent$indent\n$indent$indent\n);
431 0 0         return $start if !$data_html_config{ $ident }->{'inc_perpage'};
432 0 0 0       my $colspan = exists $data_html_config{ $ident }->{'items_per_row'} && int($data_html_config{ $ident }->{'items_per_row'}) ? int($data_html_config{ $ident }->{'items_per_row'}) : 2;
433 0           $colspan = ($colspan * 2);
434 0           return qq($start$indent$indent
) . $self->get_perpage_html() . qq(
435             },
436             'bot' => sub {
437 0     0     my ($self, $indent) = @_;
438 0           my $ident = ident $self;
439 0           my $start = qq($indent
\n);
440 0 0         return $start if !$data_html_config{ $ident }->{'inc_perpage'};
441 0 0 0       my $colspan = exists $data_html_config{ $ident }->{'items_per_row'} && int($data_html_config{ $ident }->{'items_per_row'}) ? int($data_html_config{ $ident }->{'items_per_row'}) : 2;
442 0           $colspan = ($colspan * 2);
443 0           return qq($indent$indent
) . $self->get_perpage_html() . qq(
444             },
445             'header' => sub {
446 0     0     my ($self, $indent) = @_;
447 0           my $ident = ident $self;
448 0 0         return '' if $data_html_config{ ident $self }->{'stop_headers'};
449 0 0 0       my $colspan = exists $data_html_config{ $ident }->{'items_per_row'} && int($data_html_config{ $ident }->{'items_per_row'}) ? int($data_html_config{ $ident }->{'items_per_row'}) : 2;
450 0           $colspan = ($colspan * 2);
451 0           return qq($indent$indent
Setup Mode: Header, 'header' key needs set
452             },
453             'inc_perpage' => 0,
454             'start_header' => 1,
455             'items_per_row' => 1,
456             'headers_every' => 10,
457             'stop_headers' => 0,
458             'restart_row_alt_on_header' => 1,
459             'start_array_index_at_zero' => 0,
460             'idx_handler' => sub {
461 0     0     my ($self, $indent, $array_idx, $col_alt) = @_;
462             # $array_idx = 'undef' if !defined $array_idx;
463 0 0         if(!defined $array_idx) {
464 0           $data_html_config{ ident $self }->{'stop_headers'} = 1;
465 0           return 'Setup mode empty filler
466             }
467 0           return qq($indent$indent$indentSetup Mode: idx_handler array index: $array_idx'idx_handler' key needs set
468             },
469             'prerow' => sub {
470 0     0     my ($self, $indent, $row_alt) = @_;
471 0           return qq($indent$indent
472             },
473             'pstrow' => sub {
474 0     0     my ($self, $indent, $row_alt) = @_;
475 0           return qq($indent$indent
476             },
477 0           'no_results' => 'Sorry, no entries were found.',
478             };
479              
480             # ...change any that were passed
481 0 0         $self->set_data_html_config( $arg_ref->{'data_html_config'} )
482             if ref $arg_ref->{'data_html_config'} eq 'HASH';
483            
484             # ditto
485 0           $perpage_html_config{ $ident } = {
486             'allowed' => {},
487             'all_string' => 'All',
488             'pp_string' => 'Per Page: ',
489             'pp_param' => 'pp',
490             };
491              
492 0 0         $self->set_perpage_html_config( $arg_ref->{'perpage_html_config'}, 1 )
493             if ref $arg_ref->{'perpage_html_config'} eq 'HASH';
494            
495 0           $self->_calculate();
496             }
497              
498             sub set_perpage_html_config {
499 0     0 0   my($self, $hashref, $trustme_nocalc) = @_;
500 0           my $pp = '';
501            
502 0           for my $key (keys %{ $perpage_html_config{ ident $self } }) {
  0            
503 0 0         next if !exists $hashref->{$key};
504 0 0 0       if(ref $perpage_html_config{ ident $self }->{$key} && ref $perpage_html_config{ ident $self }->{$key} ne ref $hashref->{$key}) {
505 0           my $ref = ref $perpage_html_config{ ident $self }->{$key};
506 0 0         $ref = $ref eq 'ARRAY' ? "an $ref" : "a $ref";
507 0           carp "$key must be $ref reference";
508             }
509             # elsif( ( $key eq 'foo' || $key eq 'bar') && ($hashref->{$key} !~ m{^\d+$} || $hashref->{$key} <= 0) ) {
510             # carp "$key must be numeric and greater then zero";
511             # }
512             else {
513 0           $perpage_html_config{ ident $self }->{$key} = $hashref->{$key};
514             }
515             }
516            
517 0 0         if( keys %{ $perpage_html_config{ ident $self }->{'allowed'} }) {
  0            
518 0           my $test = $param_handler{ ident $self }->( $perpage_html_config{ ident $self }->{'pp_param'} );
519 0   0       $pp = $test || '';
520 0 0 0       $pp = '' if !$pp || !exists $perpage_html_config{ ident $self }->{'allowed'}{$test};
521 0 0 0       if(exists $perpage_html_config{ ident $self }->{'allowed'}{'0'} && $pp eq '' && $test eq '0') {
      0        
522 0           $pp = $total_entries{ ident $self };
523 0           $perpage_html_config{ ident $self }->{'is_all'} = 1
524             }
525             else {
526 0           $perpage_html_config{ ident $self }->{'is_all'} = 0;
527             }
528             }
529              
530 0 0         if($pp) {
531 0 0         if($trustme_nocalc) {
532 0           $entries_per_page{ ident $self } = $pp;
533             }
534             else {
535 0           $self->set_entries_per_page( $pp );
536             }
537             }
538            
539 0           return 1;
540             }
541            
542             sub set_data_html_config {
543 0     0 0   my($self, $hashref) = @_;
544              
545 0           for my $key (keys %{ $data_html_config{ ident $self } }) {
  0            
546 0 0         next if !exists $hashref->{$key};
547 0 0 0       if(ref $data_html_config{ ident $self }->{$key} && ref $data_html_config{ ident $self }->{$key} ne ref $hashref->{$key}) {
    0 0        
      0        
      0        
548 0           my $ref = ref $data_html_config{ ident $self }->{$key};
549 0 0         $ref .= $ref eq 'ARRAY' ? "an $ref" : "a $ref";
550 0           carp "$key must be $ref reference";
551             }
552             elsif( ( $key eq 'items_per_row' || $key eq 'headers_every') && ($hashref->{$key} !~ m{^\d+$} || $hashref->{$key} <= 0) ) {
553 0           carp "$key must be numeric and greater then zero";
554             }
555             else {
556 0           $data_html_config{ ident $self }->{$key} = $hashref->{$key};
557             }
558             }
559 0           return 1;
560             }
561            
562             sub get_navi_html {
563 0     0 1   my($self, $nostyle) = @_;
564 0           my $ident = ident $self;
565              
566             my $fixq = sub {
567 0 0   0     $ext_obj{ ident $self }->delete($page_param{ $ident }) if defined $page_param{ $ident };
568 0 0         $ext_obj{ ident $self }->delete($set_param{ $ident }) if defined $page_param{ $ident };
569 0 0         $ext_obj{ ident $self }->delete($total_entries_param{ $ident }) if defined $total_entries_param{ $ident };
570 0 0         $ext_obj{ ident $self }->param($total_entries_param{ $ident }, $total_entries{ $ident })
571             if $total_entries_param{ $ident };
572 0 0         $ext_obj{ ident $self }->param($total_entries_verify_param_name{ $ident }, $total_entries_verify_param_value{ $ident })
573             if $total_entries_verify_param_value{ $ident };
574 0           1;
575 0           };
576              
577 0           $fixq->(); # do it here to clear current data
578              
579 0 0         $page_param{ $ident } = 'pg' if !$page_param{ $ident };
580 0 0         $set_param{ $ident } = 'st' if !$set_param{ $ident };
581              
582             # my $pgn = shift;
583             # my $hsh = shift;
584             # if(ref($hsh) eq 'HASH') { for(keys %{ $hsh }) { $var->($_,$hsh->{$_}); } }
585             # $fixq->(); # do it again here in case they changed the param names on us
586              
587 0           my $slf = $ext_obj{ ident $self }->url(relative=>1);
588 0           my $sets = '';
589 0           my $page = '';
590              
591 0           my $ws = ' ' x $html_line_white_space{ $ident };
592              
593 0 0         my $div = $as_table{ $ident } ? 'tr' : 'div';
594 0 0         my $spn = $as_table{ $ident } ? 'td' : 'span';
595 0 0         my $tbl = $as_table{ $ident } ? $ws : '';
596 0 0         my $beg = $as_table{ $ident } ? "$ws\n" : "\n";
597 0 0         my $end = $as_table{ $ident } ? "$ws
\n" : '';
598            
599             # TODO-0 as_table if num of pages_in_set != $ numeber of sets (add more
600             # TODO1 if($sets_in_rows{ $ident } && $pages_per_set{ $ident }) {
601             #
602             # TODO1 } else {
603 0           my ($simple_prev,$simple_next) = ('','');
604 0 0         if($pages_per_set{ $ident }) {
605 0 0 0       if($one_set_hide{ $ident } && $last_set{ $ident } == 1) { $sets = $one_set_html{ $ident }; }
  0            
606             else {
607 0           $sets .= "$ws$tbl<$div class=\"$cssid_set{ $ident }\">\n";
608 0 0         $sets .= "$ws$tbl$ws<$spn class=\"cssid_set\">$of_set_html{ $ident }\n" if $use_of_vars{ $ident };
609 0 0         $simple_prev .= qq($ws$tbl$ws<$spn class="$cssid_not_current_set{ $ident }">$no_prev_set_html{ $ident }\n) if !$previous_set{ $ident };
610 0 0         if($previous_set{ $ident }) {
611 0           $ext_obj{ ident $self }->param($set_param{ $ident }, $previous_set{ $ident });
612 0           my $url = $slf . '?' . $ext_obj{ ident $self }->query_string();
613 0           $ext_obj{ ident $self }->delete($set_param{ $ident });
614 0           $simple_prev .= qq($ws$tbl$ws<$spn class="$cssid_not_current_set{ $ident }">$prev_set_html{ $ident }\n);
615             }
616 0           $sets .= $simple_prev;
617              
618 0   0       my $strt = $first_set_in_set{ $ident } || $first_set{ $ident };
619 0 0 0       my $last = $last_set_in_set{ $ident } < $last_set{ $ident } && $last_set_in_set{ $ident } > 0 ? $last_set_in_set{ $ident } : $last_set{ $ident };
620             # my $strt = $first_set{ $ident };
621             # my $last = $last_set{ $ident };
622              
623 0           for($strt .. $last) {
624 0           $ext_obj{ ident $self }->param($set_param{ $ident }, $_);
625 0           my $url = $slf . '?' . $ext_obj{ ident $self }->query_string();
626 0           $ext_obj{ ident $self }->delete($set_param{ $ident });
627              
628 0   0       my $disp = $set_result_display_map{ $ident }->{$_} || $_;
629 0 0         $sets .= qq($ws$tbl$ws<$spn class="$cssid_current_set{ $ident }">$pre_current_set{ $ident }$disp$pst_current_set{ $ident }\n) if $_ == $current_set{ $ident };
630 0 0         $sets .= qq($ws$tbl$ws<$spn class="$cssid_not_current_set{ $ident }">$pre_not_current_set{ $ident }$disp$pst_not_current_set{ $ident }\n) if $_ != $current_set{ $ident };
631             }
632 0 0         $simple_next .= qq($ws$tbl$ws<$spn class="$cssid_not_current_set{ $ident }">$no_next_set_html{ $ident }\n) if !$next_set{ $ident };
633 0 0         if($next_set{ $ident }) {
634 0           $ext_obj{ ident $self }->param($set_param{ $ident }, $next_set{ $ident });
635 0           my $url = $slf . '?' . $ext_obj{ ident $self }->query_string();
636 0           $ext_obj{ ident $self }->delete($set_param{ $ident });
637 0           $simple_next .= qq($ws$tbl$ws<$spn class="$cssid_not_current_set{ $ident }">$next_set_html{ $ident }\n);
638             }
639 0           $sets .= $simple_next;
640 0           $sets .= "$ws$tbl\n";
641             }
642             }
643 0 0 0       if($one_page_hide{ $ident } && $last_page{ $ident } == 1) { $page = $one_page_html{ $ident }; }
  0            
644             else {
645 0           $page .= "$ws$tbl<$div class=\"$cssid_page{ $ident }\">\n";
646 0 0         $page .= "$ws$tbl$ws<$spn class=\"cssid_page\">$of_page_html{ $ident }\n" if $use_of_vars{ $ident };
647 0 0         $page .= $simple_prev if $simple_nav{ $ident };
648             # todo: uninitialized value [???]:
649 0 0         $page .= qq($ws$tbl$ws<$spn class="$cssid_not_current_page{ $ident }">$no_prev_page_html{ $ident }\n) if !$previous_page{ $ident };
650 0 0         if($previous_page{ $ident }) {
651 0           $ext_obj{ ident $self }->param($page_param{ $ident }, $previous_page{ $ident });
652 0           my $url = $slf . '?' . $ext_obj{ ident $self }->query_string();
653 0           $ext_obj{ ident $self }->delete($page_param{ $ident });
654 0           $page .= qq($ws$tbl$ws<$spn class="$cssid_not_current_page{ $ident }">$prev_page_html{ $ident }\n);
655             }
656 0   0       my $strt = $first_page_in_set{ $ident } || $first_page{ $ident };
657 0 0 0       my $stop = $last_page_in_set{ $ident } < $last_page{ $ident } && $last_page_in_set{ $ident } > 0 ? $last_page_in_set{ $ident } : $last_page{ $ident };
658 0           for($strt .. $stop) {
659 0           $ext_obj{ ident $self }->param($page_param{ $ident }, $_);
660 0           my $url = $slf . '?' . $ext_obj{ ident $self }->query_string();
661 0           $ext_obj{ ident $self }->delete($page_param{ $ident });
662              
663 0   0       my $disp = $page_result_display_map{ $ident }->{$_} || $_;
664 0 0         $page .= qq($ws$tbl$ws<$spn class="$cssid_current_page{ $ident }">$pre_current_page{ $ident }$disp$pst_current_page{ $ident }\n) if $_ == $current_page{ $ident };
665 0 0         $page .= qq($ws$tbl$ws<$spn class="$cssid_not_current_page{ $ident }">$pre_not_current_page{ $ident }$disp$pst_not_current_page{ $ident }\n) if $_ != $current_page{ $ident };
666             }
667 0 0         $page .= qq($ws$tbl$ws<$spn class="$cssid_not_current_page{ $ident }">$no_next_page_html{ $ident }\n) if !$next_page{ $ident };
668 0 0         if($next_page{ $ident }) {
669 0           $ext_obj{ ident $self }->param($page_param{ $ident }, $next_page{ $ident });
670 0           my $url = $slf . '?' . $ext_obj{ ident $self }->query_string();
671 0           $ext_obj{ ident $self }->delete($page_param{ $ident });
672 0           $page .= qq($ws$tbl$ws<$spn class="$cssid_not_current_page{ $ident }">$next_page_html{ $ident }\n);
673             }
674 0 0         $page .= $simple_next if $simple_nav{ $ident };
675 0           $page .= "$ws$tbl\n";
676             }
677             # TODO1 }
678 0 0         local $style{ $ident } = '' if $nostyle;
679 0 0         return "$ws$style{ $ident }$beg$page$end" if $simple_nav{ $ident };
680             # todo: uninitialized value [???]:
681 0 0         return wantarray ? ( "$ws$style{ $ident }$beg$page$end", "$ws$style{ $ident }$beg$sets$end" ) : "$ws$style{ $ident }$beg$page$end$beg$sets$end";
682             }
683              
684             sub get_data_html {
685 0     0 1   my($self, $myconf) = @_;
686            
687 0           my $orig = $self->get_data_html_config();
688              
689 0 0 0       $self->set_data_html_config( $myconf ) if(defined $myconf && ref $myconf eq 'HASH');
690            
691 0           my $conf = $self->get_data_html_config();
692              
693 0           my $ws = ' ' x $html_line_white_space{ ident $self };
694              
695 0           require List::Cycle;
696 0           my $col_alt = List::Cycle->new({ 'values' => $conf->{'col_alt_ar'} });
697 0           my $row_alt = List::Cycle->new({ 'values' => $conf->{'row_alt_ar'} });
698            
699 0 0         my $cols = int $conf->{'items_per_row'} ? int $conf->{'items_per_row'} : 1;
700 0           my $rows = POSIX::ceil( $entries_per_page{ ident $self } / $cols );
701            
702 0 0         my $startit = $conf->{'start_array_index_at_zero'} ? 0 : $self->get_first() - 1;
703 0           my $current = $startit + $cols;
704            
705 0           my $return = '';
706 0 0   0     my $print = defined wantarray ? sub { $return .= $_ for @_; } : sub { print @_; };
  0            
  0            
707              
708 0           $print->( $conf->{'top'}->($self, $ws) );
709             # $print->( $conf->{'header'}->($self, $ws) ) if $conf->{'start_header'};
710            
711             ROW:
712 0           for my $cur_row (0 .. ($rows - 1)) {
713 0 0         if( !($cur_row % $conf->{'headers_every'}) ) {
714 0 0 0       $print->( $conf->{'header'}->($self, $ws) )
715             if !(!$conf->{'start_header'} && $cur_row == 0);
716 0 0         $row_alt->reset() if $conf->{'restart_row_alt_on_header'};
717             }
718 0 0         last ROW if $startit >= $total_entries{ ident $self };
719              
720 0           my $no_more_rows = 0;
721 0           my $rowalt = $row_alt->next();
722 0           $print->( $conf->{'prerow'}->( $self, $ws, $rowalt ) );
723 0           for my $ar_idx ($startit .. ($current - 1)) {
724 0 0         $ar_idx = undef if $ar_idx >= $total_entries{ ident $self };
725 0 0         $no_more_rows++ if !defined $ar_idx;
726 0           $print->( $conf->{'idx_handler'}->( $self, $ws, $ar_idx, $col_alt->next() ) );
727             }
728 0           $print->( $conf->{'pstrow'}->( $self, $ws, $rowalt ) );
729 0 0         last ROW if $no_more_rows;
730 0           $startit += $cols;
731 0           $current += $cols;
732             }
733            
734 0           $print->( $conf->{'bot'}->($self, $ws) );
735              
736 0 0 0       $self->set_data_html_config($orig) if(defined $myconf && ref $myconf eq 'HASH');
737            
738 0 0         return $return if $return;
739             }
740            
741             sub get_navi_data_navi {
742 0     0 0   my ($self, $join) = @_;
743 0   0       $join ||= "
\n";
744 0           return join($join, scalar $self->get_navi_html(), $self->get_data_html(), scalar $self->get_navi_html(1));
745             }
746            
747             sub get_perpage_html {
748 0     0 0   my ($self, $asopts) = @_;
749 0           my $ident = ident $self;
750              
751 0           my $ws = ' ' x $html_line_white_space{ $ident };
752 0 0         my $html = $asopts ? qq($ws$ws
753             : '';
754            
755 0           my $pp_value = $ext_obj{ ident $self }->param( $perpage_html_config{ $ident }->{'pp_param'} );
756 0 0         if ( !exists $perpage_html_config{ $ident }->{'allowed'}{ $pp_value } ) {
757 0           $ext_obj{ ident $self }->param( $perpage_html_config{ $ident }->{'pp_param'}, $entries_per_page{ ident $self });
758 0           $pp_value = $entries_per_page{ ident $self };
759             }
760              
761 0 0         $ext_obj{ ident $self }->param($total_entries_verify_param_name{ $ident }, $total_entries_verify_param_value{ $ident })
762             if $total_entries_verify_param_value{ $ident };
763            
764 0           my $slf = $ext_obj{ ident $self }->url(relative=>1);
765              
766 0 0         if(keys %{ $perpage_html_config{ $ident }->{'allowed'} }) {
  0            
767 0           for my $num ( sort { $a <=> $b } grep { $_ > 0 } keys %{ $perpage_html_config{ $ident }->{'allowed'} }) {
  0            
  0            
  0            
768 0 0         if($num == $entries_per_page{ ident $self }) {
769 0 0         $html .= $asopts ? qq($ws$ws$ws\n)
770             : qq($pre_current_page{ ident $self }$num$pst_current_page{ ident $self } );
771             }
772             else {
773 0 0         if(!$asopts) {
774 0           $ext_obj{ ident $self }->param($perpage_html_config{ $ident }->{'pp_param'}, $num);
775 0           my $url = $slf . '?' . $ext_obj{ ident $self }->query_string();
776 0           $html .= qq($pre_not_current_page{ ident $self }$num$pst_not_current_page{ ident $self } );
777 0           $ext_obj{ ident $self }->param( $perpage_html_config{ $ident }->{'pp_param'}, $pp_value );
778             }
779             else {
780 0           $html .= qq($ws$ws$ws\n)
781             }
782             }
783             }
784            
785 0 0         if(exists $perpage_html_config{ $ident }->{'allowed'}{'0'}) {
786 0 0 0       if($entries_per_page{ ident $self } == $total_entries{ ident $self } && $perpage_html_config{ $ident }->{'is_all'}) {
787 0 0         $html .= $asopts ? qq($ws$ws$ws\n)
788             : qq($pre_current_page{ ident $self }$perpage_html_config{ $ident }->{'all_string'}$pst_current_page{ ident $self } );
789             }
790             else {
791 0 0         if(!$asopts) {
792 0           $ext_obj{ ident $self }->param($perpage_html_config{ $ident }->{'pp_param'}, 0);
793 0           my $url = $slf . '?' . $ext_obj{ ident $self }->query_string();
794 0           $html .= qq($pre_not_current_page{ ident $self }$perpage_html_config{ $ident }->{'all_string'}$pst_not_current_page{ ident $self } );
795 0           $ext_obj{ ident $self }->param( $perpage_html_config{ $ident }->{'pp_param'}, $pp_value );
796             }
797             else {
798 0           $html .= qq($ws$ws$ws\n);
799             }
800             }
801             }
802             }
803            
804 0 0         if(!$asopts) {
805 0           $html =~ s{ $}{};
806 0 0         $html = $perpage_html_config{ $ident }->{'pp_string'} . $html if $html;
807             }
808             else {
809 0           $html .= "$ws$ws\n";
810             }
811              
812 0           return $html;
813             }
814            
815             sub get_perpage_html_select {
816 0     0 0   shift->get_perpage_html(1);
817             }
818            
819             sub _default_style {
820 0     0     my($self) = @_;
821 0           my $ws = ' ' x $html_line_white_space{ ident $self };
822 0           return <<"END_CSS";
823             $ws
873             END_CSS
874             }
875              
876             } #### end scoping "inside-out" class ##
877              
878             1;
879              
880             __END__