| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Sledge::Plugin::Paginate; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
23476
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
32
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
49
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
449
|
use Data::Page; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $REQUEST_PARAM = 'page'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import { |
|
12
|
|
|
|
|
|
|
my $self = shift; |
|
13
|
|
|
|
|
|
|
my $pkg = caller; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
no strict 'refs'; |
|
16
|
|
|
|
|
|
|
*{"$pkg\::paginate"} = sub { |
|
17
|
|
|
|
|
|
|
my ($self , %args) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $pager = Data::Page->new( |
|
20
|
|
|
|
|
|
|
scalar(@{$args{data}}), |
|
21
|
|
|
|
|
|
|
$args{paging_num}, |
|
22
|
|
|
|
|
|
|
$self->r->param($REQUEST_PARAM) || 0, |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$self->tmpl->param( |
|
26
|
|
|
|
|
|
|
$args{page_name} => [ $pager->splice($args{data}) ], |
|
27
|
|
|
|
|
|
|
pager => $pager, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
}; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Sledge::Plugin::Paginate - data paginate plugin for Sledge |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 VERSION |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This documentation refers to Sledge::Plugin::Paginate version 0.01 |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
package Your::Pages; |
|
44
|
|
|
|
|
|
|
use Sledge::Plugin::Paginate; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub dispatch_index { |
|
47
|
|
|
|
|
|
|
my $self = shift; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my @users = $self->user; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$self->paginate( |
|
52
|
|
|
|
|
|
|
paging_num => $self->config->paging_num, |
|
53
|
|
|
|
|
|
|
page_name => 'user', |
|
54
|
|
|
|
|
|
|
data => \@users, |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 paginate |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This paginate plugin can easily execute paging. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Atsushi Kobayashi, C<< >> |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 BUGS |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
71
|
|
|
|
|
|
|
C, or through the web interface at |
|
72
|
|
|
|
|
|
|
L. |
|
73
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
74
|
|
|
|
|
|
|
your bug as I make changes. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SUPPORT |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
perldoc Sledge::Plugin::Paginate |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
You can also look for information at: |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=over 4 |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
L |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
L |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
L |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item * Search CPAN |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
L |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=back |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Copyright 2006 Atsushi Kobayashi, all rights reserved. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
111
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; # End of Sledge::Plugin::Paginate |