blib/lib/CGI/Browse.pm

filter: Statementstmt 32.8% 95 / 289 Branchbran 9.6% 5 / 52 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 46.6% 14 / 30 Podpod 11.1% 1 / 9 totaltotal 30.2% 115 / 380 CC 30 SCAR 28.3
CC
30
Cov
29%
_build_table
56.0
args_to_attributes
42.0
_build_header
30.0
CRAP 17.0
↑ Summary
1 package CGI::Browse;
2 2 ▶use Class::Std;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use Class::Std::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use DBIx::MySperqlOO;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use version; our $VERSION = qv('1.0.0');
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 {
13 2 my %dbh_of :ATTR( :get<dbh> :set<dbh> );
14 2 my %connect_of :ATTR( :get<connect> :set<connect> :default<{}> :init_arg<connect> );
15 2 my %fields_of :ATTR( :get<fields> :set<fields> :default<'20'> :init_arg<fields> );
16 2 my %sql_of :ATTR( :get<sql> :set<sql> :default<''> :init_arg<sql> );
17 2 my %urls_of :ATTR( :get<urls> :set<urls> :default<{}> :init_arg<urls> );
18 2 my %sort_of :ATTR( :get<sort> :set<sort> :default<''> :init_arg<sort> );
19 2 my %sort_vec_of :ATTR( :get<sort_vec> :set<sort_vec> :default<'asc'> :init_arg<sort_vec> );
20 2 my %window_of :ATTR( :get<window> :set<window> :default<'20'> :init_arg<window> );
21 2 my %index_of :ATTR( :get<index> :set<index> :default<'0'> :init_arg<index> );
22 2 my %count_of :ATTR( :get<count> :set<count> :default<'0'> );
23 2 my %features_of :ATTR( :get<features> :set<features> :default<{}> :init_arg<features> );
24  
25 2 my %classes_of :ATTR( :get<classes> :set<classes> :default<['browseRowA','browseRowB']> :init_arg<classes> );
26
27 1 ▶ sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
28 1 my ( $self, $ident, $arg_ref ) = @_;
29 1 return;
30 }
31  
32 1 ▶ sub START {
Subroutine START: called CC=2 SCAR=7.6
Pod undocumented
33 1 my ( $self, $ident, $arg_ref ) = @_;
34 1 ▶ if (! defined $arg_ref->{no_dbh} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $arg_ref->{"no_dbh"}) 0 1 1
35 0 $self->set_dbh( DBIx::MySperqlOO->new($self->get_connect()) );
36 }
37 1 return;
38 }
39  
40 0 ▶ sub dbh { my ( $self ) = @_; return $self->get_dbh(); }
Subroutine dbh: not called CC=1 SCAR=6.9
Pod undocumented
41  
42 1 ▶ sub delete_enabled {
Subroutine delete_enabled: called CC=2 SCAR=7.4
Pod undocumented
43 1 my ( $self ) = @_;
44 1 my $delete = '';
45 0 ▶ if ( defined $self->get_features()->{delete} ) { $delete = $self->get_features()->{delete}; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->get_features->{"delete"}) 0 1 1
46 1 return $delete;
47 }
48  
49 0 ▶ sub args_to_attributes {
Subroutine args_to_attributes: not called CC=6 SCAR=37.4
Pod undocumented
50 0 my ($self, $arg_ref) = @_;
51 0 ▶ if ( defined $arg_ref->{index} ) { $self->set_index( $arg_ref->{index} ); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $arg_ref->{"index"}) 0 0 0
52 0 ▶ if ( defined $arg_ref->{window} ) { $self->set_window( $arg_ref->{window} ); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $arg_ref->{"window"}) 0 0 0
53 0 ▶ if ( defined $arg_ref->{sort} ) { $self->set_sort( $arg_ref->{sort} ); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $arg_ref->{"sort"}) 0 0 0
54 0 ▶ if ( defined $arg_ref->{sort_vec} ) { $self->set_sort_vec( $arg_ref->{sort_vec} ); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $arg_ref->{"sort_vec"}) 0 0 0
55 0 ▶ if ( defined $arg_ref->{features} ) { $self->set_features( $arg_ref->{features} ); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $arg_ref->{"features"}) 0 0 0
56 }
57  
58 0 ▶ sub build {
Subroutine build: not called CC=3 SCAR=24.8
Pod documented
59 0 my ($self, $arg_ref) = @_;
60 0 my $build = {};
61  
62 0 $self->args_to_attributes( $arg_ref );
63 0 $self->set_count( $self->_get_row_count() );
64  
65 0 $build->{browse_styles} = $self->_build_styles();
66 0 $build->{browse_script} = $self->_build_javascript();
67 0 $build->{browse_action} = $self->get_urls()->{root} . $self->get_urls()->{browse};
68 0 $build->{browse_table} = $self->_build_table();
69 0 $build->{browse_sorted} = $self->_build_sorted();
70 0 $build->{browse_start} = $self->_build_start();
71 0 $build->{browse_prevnext} = $self->_build_prev_next();
72 0 $build->{browse_show} = $self->_build_show();
73 0 $build->{browse_goto} = $self->_build_goto();
74 0 $build->{browse_control} = $self->_build_control();
75 0 $build->{browse_delete} = $self->_build_delete();
76  
77 0 ▶ if (defined $self->get_features->{default_html} ) { # Defined And
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->get_features->{'default_html'}) { } 0 0 0
78 0 ▶ if ( $self->get_features->{default_html} ) { # Also True
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_features->{'default_html'}) { } 0 0 0
79 0 return $self->_build_default_html( $build );
80 0 } else { return $build; } # Default HTML False
81 } else {
82 0 return $build; # Default HTML Undefined
83 }
84 }
85  
86 3 ▶ sub build_sql {
Subroutine build_sql: called CC=2 SCAR=6.9
Pod undocumented
87 3 my ( $self, $arg_ref ) = @_;
88 3 my $sql = $self->get_sql();
89 3 my $sort = $self->get_sort();
90 3 my $sort_vec = $self->get_sort_vec();
91 3 my $index = $self->get_index();
92 3 my $window = $self->get_window();
93  
94 # Add sort
95 3 ▶ if ( $sort ) { $sql .= " order by $sort $sort_vec"; }
Branch: 1 branch
BranchTrueFalseTotal
if ($sort) 3 0 3
96  
97 # Add limit
98 3 $sql .= " limit $index, $window";
99  
100 3 return $sql;
101 }
102  
103 1 ▶ sub _build_javascript {
Subroutine _build_javascript: called CC=2 SCAR=8.2
104 1 my ( $self ) = @_;
105 1 my $url = $self->get_urls()->{root} . $self->get_urls()->{browse};
106 1 my $html = '<script language="javascript">' . "\n";
107 1 $html .= 'function browseSetWindow() {' . "\n";
108 1 $html .= ' document.browse.action = "' . $url . '";' . "\n";
109 1 $html .= ' document.browse.submit();' . "\n";
110 1 $html .= '}' . "\n";
111 1 $html .= 'function browseSetIndex(index) {' . "\n";
112 1 $html .= ' document.getElementById("index").value = index;' . "\n";
113 1 $html .= ' document.browse.action = "' . $url . '";' . "\n";
114 1 $html .= ' document.browse.submit();' . "\n";
115 1 $html .= '}' . "\n";
116 1 $html .= 'function browseSort(sort) {' . "\n";
117 1 $html .= ' var current = document.getElementById("sort").value;' . "\n";
118 1 $html .= ' if ( current == sort ) {' . "\n";
119 1 $html .= ' var vector = document.getElementById("sort_vec").value;' . "\n";
120 1 $html .= ' if ( vector == "asc" ) {' . "\n";
121 1 $html .= ' document.getElementById("sort_vec").value = "desc";' . "\n";
122 1 $html .= ' } else {' . "\n";
123 1 $html .= ' document.getElementById("sort_vec").value = "asc";' . "\n";
124 1 $html .= ' }' . "\n";
125 1 $html .= ' } else {' . "\n";
126 1 $html .= ' document.getElementById("sort_vec").value = "asc";' . "\n";
127 1 $html .= ' }' . "\n";
128 1 $html .= ' document.getElementById("sort").value = sort;' . "\n";
129 1 $html .= ' document.browse.action = "' . $url . '";' . "\n";
130 1 $html .= ' document.browse.submit();' . "\n";
131 1 $html .= '}' . "\n";
132 1 ▶ if ( $self->delete_enabled() eq 'multi' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->delete_enabled eq "multi") 0 1 1
133 0 my $url = $self->get_urls()->{root} . $self->get_urls()->{delete};
134 0 $html .= 'function browseDelete() {' . "\n";
135 0 $html .= ' var myIDs = new Array();' . "\n";
136 0 $html .= ' for ( var i = 0; i < document.browse.elements.length; i++ ) {' . "\n";
137 0 $html .= ' if (document.browse.elements[i].type == "checkbox" ) {' . "\n";
138 0 $html .= ' if (document.browse.elements[i].checked) {' . "\n";
139 0 $html .= ' var DelID = document.browse.elements[i].name.split(".");' . "\n";
140 0 $html .= ' if (DelID[0] == "delete") {' . "\n";
141 0 $html .= ' myIDs.push(DelID[1]);' . "\n";
142 0 $html .= ' }' . "\n";
143 0 $html .= ' }' . "\n";
144 0 $html .= ' }' . "\n";
145 0 $html .= ' }' . "\n";
146 0 $html .= ' if ( myIDs.length > 0 ) {' . "\n";
147 0 $html .= ' document.getElementById("delete_ids").value = myIDs.join();' . "\n";
148 0 $html .= ' document.browse.action = "' . $url . '";' . "\n";
149 0 $html .= ' document.browse.submit();' . "\n";
150 0 $html .= ' } else {' . "\n";
151 0 $html .= ' alert("No delete checkboxes selected.");' . "\n";
152 0 $html .= ' }' . "\n";
153 0 $html .= '}' . "\n";
154 }
155 1 $html .= '</script>' . "\n";
156 1 return $html;
157 }
158  
159 1 ▶ sub _build_styles {
Subroutine _build_styles: called CC=1 SCAR=0.0
160 1 my $styles = <<STYLES_END;
161 <style type=\"text/css\">
162 HTML { background-color:#FFFFFF; }
163 BODY { background-color:#FFFFFF; }
164 TD { font-family:arial; font-size:9pt; }
165 TD.browseHead { background-color:#666666; color:white; padding-left:4; padding-right:4; text-a
166 TD.browseRowA { background-color:#FFEEEE; font-size:9pt; padding-left:2; color:black; text-ali
167 TD.browseRowB { background-color:#FFDDDD; font-size:9pt; padding-left:2; color:black; text-ali
168 A.browseHead:link { color:#FFFFFF; text-decoration:underline; }
169 A.browseHead:visited { color:#FFFFFF; text-decoration:underline; }
170 A.browseHead:hover { color:#FFFFFF; text-decoration:underline; }
171 A.browseLink:link { color:#660000; text-decoration:underline; }
172 A.browseLink:visited { color:#660000; text-decoration:underline; }
173 A.browseLink:hover { color:#660000; text-decoration:underline; }
174 A.browseDelete:link { color:#000000; text-decoration:underline; padding-left:4; padding-right:4; }
175 A.browseDelete:visited { color:#000000; text-decoration:underline; padding-left:4; padding-right:4; }
176 A.browseDelete:hover { color:#000000; text-decoration:underline; padding-left:4; padding-right:4; }
177 A.browsePrevNextOn:link { color:#000000; text-decoration:underline; font-size:9pt; }
178 A.browsePrevNextOn:visited { color:#000000; text-decoration:underline; font-size:9pt; }
179 A.browsePrevNextOn:hover { color:#000000; text-decoration:underline; font-size:9pt; }
180 font.browseInfo { font-family:arial; text-align:left; line-height:110%; font-style:italic; font-
181 font.browsePrevNextOff { color:#999999; text-decoration:underline; font-size:9pt; }
182 font.browsePrevNextOff { color:#999999; text-decoration:underline; font-size:9pt; }
183 font.browsePrevNextOff { color:#999999; text-decoration:underline; font-size:9pt; }
184 .browseSmallBox { font-family:arial; font-size:7pt; height:16; width:18; text-align:center; colo
185 .browseSmallSelect { font-family:arial; font-size:7pt; height:16; text-align:center; color:#660000;
186 .browseSmallButton { font-family:arial; font-size:7pt; height:16; text-align:center; color:#FFFFFF;
187 </style>
188 STYLES_END
189 1 return $styles;
190 }
191  
192 0 ▶ sub _build_table {
Subroutine _build_table: not called CC=7 SCAR=40.3
193 0 my ($self, $arg_ref) = @_;
194  
195 0 my $fields = $self->get_fields();
196 0 my @classes = @{ $self->get_classes() };
197 0 my $class_count = scalar(@classes);
198 0 my $class_index = 0;
199 0 my $rows = $self->_get_rows( $arg_ref );
200  
201 0 my $html = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n";
202 0 $html .= $self->_build_header();
203  
204 0 foreach my $row ( @$rows ) {
205 0 my $class = $classes[($class_index++) % $class_count];
206 0 my $field_count = 0;
207 0 my @permitted = ();
208  
209 0 $html .= ' <tr>' . "\n";
210 0 my $delete = $self->delete_enabled();
211 0 ▶ if ( $delete eq 'multi' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($delete eq 'multi') { } 0 0 0
elsif ($delete) { } 0 0 0
212 0 my $id = $row->[0];
213 0 $html .= ' <td valign="top" class="' . $class . '"> <input type="checkbox" name="delete.' . $id . '" id="delete.' . $id . '"> </td>' . "\n";
214 }
215 elsif ( $delete ) {
216 0 my $url = $self->get_urls()->{root} . $self->get_urls()->{delete};
217 0 my $id = $row->[0];
218 0 $html .= ' <td valign="top" class="' . $class . '"> <a class="browseDelete" href="' . $url . $id . '">[X]</a></td>' . "\n";
219 }
220 0 foreach my $data ( @$row ) {
221 0 ▶ if (! $fields->[$field_count]->{hide} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($fields->[$field_count]{"hide"}) 0 0 0
222 0 ▶ if ( $fields->[$field_count]->{link} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fields->[$field_count]{'link'}) { } 0 0 0
223 0 my $url = $self->get_urls()->{root} . $self->get_urls()->{ $fields->[$field_count]->{link} };
224 0 my $id = $row->[$fields->[$field_count]->{id}];
225 0 $html .= ' <td valign="top" class="' . $class . '"> <a class="browseLink" href="' . $url . $id . '">' . $data . '</a></td>' . "\n";
226 } else {
227 0 $html .= ' <td valign="top" class="' . $class . '"> ' . $data . '</td>' . "\n";
228 }
229 }
230 0 $field_count++;
231 }
232 0 $html .= ' </tr>' . "\n";
233 }
234 0 $html .= '</table>' . "\n";
235  
236 0 return $html;
237 }
238  
239 0 ▶ sub _build_header {
Subroutine _build_header: not called CC=5 SCAR=34.0
240 0 my ( $self ) = @_;
241 0 my $fields = $self->get_fields();
242 0 my $html .= ' <tr>' . "\n";
243 0 ▶ if ( $self->delete_enabled() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->delete_enabled) 0 0 0
244 0 $html .= ' <td valign="top" class="browseHead"> &nbsp; </td>' . "\n";
245 }
246 0 foreach my $field ( @$fields ) {
247 0 ▶ if (! $field->{hide} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($field->{"hide"}) 0 0 0
248 0 ▶ if ( $field->{sort} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($field->{'sort'}) { } 0 0 0
249 0 $html .= ' <td valign="top" class="browseHead"> <a class="browseHead" href="javascript:browseSort(\'' . $field->{name} . '\');">' . $field->{label} . '</a> </td>' . "\n";
250 } else {
251 0 $html .= ' <td valign="top" class="browseHead"> ' . $field->{label} . '</td>' . "\n";
252 }
253 }
254 }
255 0 $html .= ' </tr>' . "\n";
256 0 return $html;
257 }
258  
259 0 ▶ sub _build_sorted {
Subroutine _build_sorted: not called CC=2 SCAR=17.9
260 0 my ( $self ) = @_;
261 0 my $sort = $self->get_sort();
262 0 $sort =~ s/_/ /g;
263 0 ▶ $sort = $sort ? $sort : 'default';
Branch: 1 branch
BranchTrueFalseTotal
$sort ? : 0 0 0
264 0 return '<font class="browseInfo"> Sorted by ' . $sort . '.</font>';
265 }
266  
267 0 ▶ sub _build_start {
Subroutine _build_start: not called CC=1 SCAR=6.9
268 0 my ( $self ) = @_;
269 0 my $count = $self->get_count();
270 0 my $index = $self->get_index();
271 0 return '<font class="browseInfo"> Starting row ' . $self->commify($index + 1) . ' / ' . $self->commify($count) . '.</font>';
272 }
273  
274 0 ▶ sub _build_prev_next {
Subroutine _build_prev_next: not called CC=4 SCAR=30.0
275 0 my ( $self ) = @_;
276 0 my $window = $self->get_window();
277 0 my $index = $self->get_index();
278 0 my $count = $self->get_count();
279 0 my ( $pindex, $nindex, $html );
280  
281 0 ▶ if ($index > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index > 0) { } 0 0 0
282 0 ▶ if ($index - $window > 0) { $pindex = $index - $window; } else { $pindex = 0; }
Branch: 1 branch
BranchTrueFalseTotal
if ($index - $window > 0) { } 0 0 0
283 0 $html .= ' <a class="browsePrevNextOn" href="javascript:browseSetIndex(\'' . $pindex . '\');">< Prev</a> | ';
284 } else {
285 0 $html .= ' <font class="browsePrevNextOff">< Prev</font> | ';
286 }
287
288 # Next rows
289 0 ▶ if ($index + $window < $count) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index + $window < $count) { } 0 0 0
290 0 $nindex = $index + $window;
291 0 $html .= '<a class="browsePrevNextOn" href="javascript:browseSetIndex(\'' . $nindex . '\');">Next ></a> ';
292 } else {
293 0 $html .= '<font class="browsePrevNextOff">Next ></font>';
294 }
295 0 return $html;
296 }
297  
298 0 ▶ sub _build_show {
Subroutine _build_show: not called CC=1 SCAR=6.9
299 0 my ( $self ) = @_;
300 0 my $window = $self->get_window();
301 0 my $html = '<font class="browseInfo">Show <input class="browseSmallBox" size="4" type="text" name="window" id="window" value="' .$window . '"> rows.</font> <input type="button" onclick="browseSetWindow();" class="browseSmallButton" value="Submit">';
302 0 return $html;
303 }
304  
305 0 ▶ sub _build_goto {
Subroutine _build_goto: not called CC=2 SCAR=17.9
306 0 my ( $self ) = @_;
307 0 my $window = $self->get_window();
308 0 my $count = $self->get_count();
309 0 my $index = 0;
310 0 my $page = 0;
311 0 my $html = '<font class="browseInfo">Go to page</font><select class="browseSmallSelect" name="page" id="page">';
312 0 ▶ while ( $index < $count ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index < $count) 0 0 0
313 0 $html .= '<option value="' . $index . '"> ' . ++$page . ' ';
314 0 $index += $window;
315 }
316 0 $html .= '</select>. <input type="button" onclick="browseSetIndex(document.getElementById(\'page\').options[document.getElementById(\'page\').selectedIndex].value);" class="browseSmallButton" value="Submit">';
317 0 return $html;
318 }
319  
320 0 ▶ sub _build_control {
Subroutine _build_control: not called CC=2 SCAR=17.9
321 0 my ( $self ) = @_;
322 0 my $index = $self->get_index();
323 0 my $sort = $self->get_sort();
324 0 my $sort_vec = $self->get_sort_vec();
325 0 my $html = '<input type="hidden" name="index" id="index" value="' . $index . '">';
326 0 $html .= '<input type="hidden" name="sort" id="sort" value="' . $sort . '">';
327 0 $html .= '<input type="hidden" name="sort_vec" id="sort_vec" value="'. $sort_vec . '">';
328 0 ▶ if ( $self->delete_enabled() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->delete_enabled) 0 0 0
329 0 $html .= '<input type="hidden" name="delete_ids" id="delete_ids" value="">';
330 }
331 0 return $html;
332 }
333  
334 0 ▶ sub _build_delete {
Subroutine _build_delete: not called CC=2 SCAR=17.9
335 0 my ( $self ) = @_;
336 0 my $html;
337 0 ▶ if ( $self->delete_enabled() eq 'multi' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->delete_enabled eq "multi") 0 0 0
338 0 my $url = $self->get_urls()->{root} . $self->get_urls()->{delete};
339 0 $html = '<input type="button" onclick="browseDelete();" class="browseSmallButton" value="Delete selected">';
340 }
341 0 return $html;
342 }
343  
344 0 ▶ sub _build_default_html {
Subroutine _build_default_html: not called CC=1 SCAR=6.9
345 0 my ( $self, $build ) = @_;
346 0 my $html = $build->{browse_script};
347 0 $html .= '<form name="browse" action="' . $build->{browse_action} . '" method="POST">' . "\n";
348 0 $html .= '<table cellspacing="0" cellpadding="0" width="100%">' . "\n";
349 0 $html .= ' <tr>' . "\n";
350 0 $html .= ' <td align="left" width="36%"> &nbsp; &nbsp; ' . $build->{browse_sorted} . ' </td>' . "\n";
351 0 $html .= ' <td align="center" width="34%">' . $build->{browse_start} . '</td>' . "\n";
352 0 $html .= ' <td align="right" width="30%">' . $build->{browse_prevnext} . '</td>' . "\n";
353 0 $html .= ' </tr>' . "\n";
354 0 $html .= '</table>' . "\n";
355 0 $html .= $build->{browse_table};
356 0 $html .= '&nbsp; <br>' . "\n";
357 0 $html .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n";
358 0 $html .= ' <tr>' . "\n";
359 0 $html .= ' <td width="36%">' . $build->{browse_show} . '</td>' . "\n";
360 0 $html .= ' <td width="34%">' . $build->{browse_delete} . '</td>' . "\n";
361 0 $html .= ' <td width="30%" align="right">' . $build->{browse_goto} . '</td>' . "\n";
362 0 $html .= ' </tr>' . "\n";
363 0 $html .= ' <tr>' . "\n";
364 0 $html .= ' <td colspan="2">' . $build->{browse_control} . '</td>' . "\n";
365 0 $html .= ' </tr>' . "\n";
366 0 $html .= '</table>' . "\n";
367 0 $html .= '</form>' . "\n";
368 0 return $html;
369 }
370  
371 0 ▶ sub _get_rows {
Subroutine _get_rows: not called CC=1 SCAR=6.9
372 0 my ( $self, $arg_ref ) = @_;
373 0 my $sql = $self->build_sql( $arg_ref );
374 0 return $self->dbh()->sqlexec( $sql, '\@@' );
375 }
376  
377 0 ▶ sub _get_row_count {
Subroutine _get_row_count: not called CC=1 SCAR=6.9
378 0 my ( $self, $arg_ref ) = @_;
379 0 my $sql = $self->build_sql( $arg_ref );
380 0 $sql =~ s/select (.*) from/select count(*) from/g;
381 0 $sql =~ s/limit.*$//g;
382 0 my ( $row_count ) = $self->dbh()->sqlexec( $sql, '@' );
383 0 return $row_count;
384 }
385  
386 0 ▶ sub commify {
Subroutine commify: not called CC=1 SCAR=6.9
Pod undocumented
387 0 my ( $self, $value ) = @_;
388 0 my $text = reverse $value;
389 0 $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
390 0 return scalar reverse $text;
391 }
392  
393 1 ▶ sub flip_sort_vec {
Subroutine flip_sort_vec: called CC=2 SCAR=7.1
Pod undocumented
394 1 my ( $self ) = @_;
395 1 my $ident = ident $self;
396 1 my $sort_vec = $sort_vec_of{$ident};
397 0 ▶ if ( $sort_vec eq 'asc' ) { $sort_vec = 'desc'; } else { $sort_vec = 'asc'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($sort_vec eq 'asc') { } 0 1 1
398 1 $self->set_sort_vec( $sort_vec );
399 1 return $sort_vec;
400 }
401 }
402  
403 2 1; # Magic true value required at end of module
404 __END__
↑ Summary