line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ========================================================================== # |
2
|
|
|
|
|
|
|
# lib/JPList.pm - JPList Main Module |
3
|
|
|
|
|
|
|
# Copyright (C) 2017 Exceleron Software, LLC |
4
|
|
|
|
|
|
|
# ========================================================================== # |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package JPList; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
63626
|
use Moose; |
|
1
|
|
|
|
|
428640
|
|
|
1
|
|
|
|
|
9
|
|
9
|
1
|
|
|
1
|
|
6041
|
use namespace::autoclean; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use JPList::Request; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'JPList::DB::Config'; |
14
|
|
|
|
|
|
|
with 'JPList::DB::Result'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# ========================================================================== # |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
JPList |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
JPList module is a data source bundle that works with Perl and database handle where as jPlist (http://jplist.com) behaves as UI module only. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 VERSION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Version 0.03 |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $jplist = JPList->new( |
35
|
|
|
|
|
|
|
{ |
36
|
|
|
|
|
|
|
dbh => $dbh, |
37
|
|
|
|
|
|
|
db_table_name => <TABLE/VIEW>, |
38
|
|
|
|
|
|
|
fields => <Custom fields or custom query>, |
39
|
|
|
|
|
|
|
where_fields => <Fixed WHERE FIELDS to be used on all queries>, |
40
|
|
|
|
|
|
|
request_params => <JPList request params statuses> |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $jplist = JPList->new({}); |
45
|
|
|
|
|
|
|
$jplist->get_resultset(); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 DESCRIPTION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
JPList module decodes the request params encoded by jplist L<ajax core module|https://raw.githubusercontent.com/no81no/jplist/master/dist/js/jplist.core-ajax.min.js> and then fetchs the data from appropriate table by applying required filter and sort options. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $jplist = JPList->new({}); |
52
|
|
|
|
|
|
|
$jplist->get_resultset(); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 ATTRIBUTES |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over 4 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# ========================================================================== # |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item C<dbh> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Params : $dbh |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Desc : Database Handle |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item C<db_table_name> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Params : $table_name |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Desc : Table name to query the result |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item C<fields> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Params : String |
77
|
|
|
|
|
|
|
'"Column1", "Column2"' |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Desc : Fields can be column list |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item C<where_fields> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Params : HASHREF |
84
|
|
|
|
|
|
|
{ |
85
|
|
|
|
|
|
|
Column1 => '' |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Desc : Table name to query the result |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item C<request_params> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Params : NONE |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Returns: NONE |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Desc : JPList request params statuses |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
has 'request_params' => ( |
101
|
|
|
|
|
|
|
is => 'rw', |
102
|
|
|
|
|
|
|
isa => 'Str', |
103
|
|
|
|
|
|
|
required => 1, |
104
|
|
|
|
|
|
|
); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
has 'jplist_request' => ( |
107
|
|
|
|
|
|
|
is => 'ro', |
108
|
|
|
|
|
|
|
isa => 'JPList::Request', |
109
|
|
|
|
|
|
|
builder => '_build_jplist_request', |
110
|
|
|
|
|
|
|
lazy => 1 |
111
|
|
|
|
|
|
|
); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# ========================================================================== # |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=back |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 METHODS |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=over 4 |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# ========================================================================== # |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item C<_build_jplist_request> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Params : NONE |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Returns: Object of JPList::Request |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Desc : Decode the Request params and return Object of JPList::Request |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub _build_jplist_request |
136
|
|
|
|
|
|
|
{ |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
my $self = shift; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
my $jplist_req = JPList::Request->new(request_params => $self->request_params); |
141
|
|
|
|
|
|
|
$jplist_req->decode_data(); |
142
|
|
|
|
|
|
|
return $jplist_req; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# ========================================================================== # |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item C<get_resultset> |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Params : $self->request_params |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Returns: Resultset data from table/view based on the request params |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Desc : Resultset data from table/view based on the request params |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub get_resultset |
158
|
|
|
|
|
|
|
{ |
159
|
|
|
|
|
|
|
my $self = shift; |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
my $data = $self->_get_resultset($self->jplist_request); |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
return $data; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
1; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
__END__ |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=back |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 AUTHORS |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Sheeju Alex, <sheeju@exceleron.com> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 BUGS |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
https://github.com/sheeju/JPList/issues |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 SUPPORT |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
perldoc JPList |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
You can also look for information at: |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=over 4 |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=JPList> |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
L<http://annocpan.org/dist/JPList> |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item * CPAN Ratings |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
L<http://cpanratings.perl.org/d/JPList> |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item * Search CPAN |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
L<http://search.cpan.org/dist/JPList/> |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=back |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 REPOSITORY |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
L<https://github.com/sheeju/JPList> |
212
|
|
|
|
|
|
|
L<https://github.com/sheeju/JPListDemo> |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Development time supported by Exceleron L<www.exceleron.com|http://www.exceleron.com>. |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Copyright (C) 2017 Exceleron Software, LLC |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
223
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
224
|
|
|
|
|
|
|
copy of the full license at: |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
L<http://www.perlfoundation.org/artistic_license_2_0> |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified |
229
|
|
|
|
|
|
|
Versions is governed by this Artistic License. By using, modifying or |
230
|
|
|
|
|
|
|
distributing the Package, you accept this license. Do not use, modify, |
231
|
|
|
|
|
|
|
or distribute the Package, if you do not accept this license. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
234
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
235
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
238
|
|
|
|
|
|
|
mark, tradename, or logo of the Copyright Holder. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
241
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
242
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
243
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
244
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
245
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
246
|
|
|
|
|
|
|
direct or contributory patent infringement, then this Artistic License |
247
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
250
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
251
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
252
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
253
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
254
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
255
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
256
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=cut |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
# vim: ts=4 |
261
|
|
|
|
|
|
|
# vim600: fdm=marker fdl=0 fdc=3 |