blib/lib/HTML/Table.pm

filter: Statementstmt 1.2% 17 / 1420 Branchbran 0.0% 0 / 942 Conditioncond 0.0% 0 / 520 MC/DCmcdc 0.0% 0 / 320 Subroutinesub 3.5% 5 / 140 Podpod 97.6% 123 / 126 totaltotal 4.1% 145 / 3468 CC 668 SCAR 52.8
CC
668
Cov
1%
new
992.0
getRow
992.0
sort
552.0
CRAP 195.8
↑ Summary
1 package HTML::Table;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use vars qw($VERSION $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 $VERSION = '2.08a';
7  
8 1 ▶use overload '""' => \&getTable,
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 fallback => undef;
10  
11 =head1 NAME
12  
13 HTML::Table - produces HTML tables
14  
15 =head1 SYNOPSIS
16  
17 use HTML::Table;
18  
19 $table1 = new HTML::Table($rows, $cols);
20 or
21 $table1 = new HTML::Table(-rows=>26,
22 -cols=>2,
23 -align=>'center',
24 -rules=>'rows',
25 -border=>0,
26 -bgcolor=>'blue',
27 -width=>'50%',
28 -spacing=>0,
29 -padding=>0,
30 -style=>'color: blue',
31 -class=>'myclass',
32 -evenrowclass=>'even',
33 -oddrowclass=>'odd',
34 -head=> ['head1', 'head2'],
35 -data=> [ ['1:1', '1:2'], ['2:1', '2:2'] ] );
36 or
37 $table1 = new HTML::Table( [ ['1:1', '1:2'], ['2:1', '2:2'] ] );
38  
39 $table1->setCell($cellrow, $cellcol, 'This is Cell 1');
40 $table1->setCellBGColor('blue');
41 $table1->setCellColSpan(1, 1, 2);
42 $table1->setRowHead(1);
43 $table1->setColHead(1);
44  
45 $table1->print;
46  
47 $table2 = new HTML::Table;
48 $table2->addRow(@cell_values);
49 $table2->addCol(@cell_values2);
50  
51 $table1->setCell(1,1, "$table2->getTable");
52 $table1->print;
53  
54 =head1 REQUIRES
55  
56 Perl5.002
57  
58 =head1 EXPORTS
59  
60 Nothing
61  
62 =head1 DESCRIPTION
63  
64 HTML::Table is used to generate HTML tables for
65 CGI scripts. By using the methods provided fairly
66 complex tables can be created, manipulated, then printed
67 from Perl scripts. The module also greatly simplifies
68 creating tables within tables from Perl. It is possible
69 to create an entire table using the methods provided and
70 never use an HTML tag.
71  
72 HTML::Table also allows for creating dynamically sized
73 tables via its addRow and addCol methods. These methods
74 automatically resize the table if passed more cell values
75 than will fit in the current table grid.
76  
77 Methods are provided for nearly all valid table, row, and
78 cell tags specified for HTML 3.0.
79  
80 A Japanese translation of the documentation is available at:
81  
82 http://member.nifty.ne.jp/hippo2000/perltips/html/table.htm
83  
84  
85 =head1 METHODS
86  
87 [] indicate optional parameters. default value will
88 be used if no value is specified
89
90 row_num indicates that a row number is required.
91 Rows are numbered from 1. To refer to the last row use the value -1.
92  
93 col_num indicates that a col number is required.
94 Cols are numbered from 1. To refer to the last col use the value -1.
95  
96
97 =head2 Sections
98  
99 =over 4
100  
101 From version 2.07 onwards HTML::Table supports table sections (THEAD, TFOOT & TBODY).
102  
103 Each section can have its own attributes (id, class, etc) set, and will contain 1 or more
104 rows. Section numbering starts at 0, only tbody is allowed to have more than one section.
105  
106 Methods for manipultaing sections and their data are available and have the general form:
107  
108 setSectionCell ( section, section_num, row_num, col_num, data );
109
110 For example, the following adds a row to the first body section:
111
112 addSectionRow ( 'tbody', 0, "Cell 1", "Cell 2", "Cell 3" );
113
114 For backwards compatibility, methods with Section in their name will default to manipulating
115 the first body section.
116  
117 For example, the following sets the class for the first row in the
118 first body section:
119
120 setRowClass ( 1, 'row_class' );
121
122 Which is semantically equivalent to:
123
124 setSectionRowClass ( 'tbody', 0, 1, 'row_class' );
125  
126 =back
127  
128 =head2 Creation
129  
130 =over 4
131  
132 =item new HTML::Table([num_rows, num_cols])
133  
134 Creates a new HTML table object. If rows and columns
135 are specified, the table will be initialized to that
136 size. Row and Column numbers start at 1,1. 0,0 is
137 considered an empty table.
138  
139 =item new HTML::Table([-rows=>num_rows,
140 -cols=>num_cols,
141 -border=>border_width,
142 -align=>table_alignment,
143 -style=>table_style,
144 -class=>table_class,
145 -evenrowclass=>'even',
146 -oddrowclass=>'odd',
147 -bgcolor=>back_colour,
148 -width=>table_width,
149 -spacing=>cell_spacing,
150 -padding=>cell_padding])
151  
152 Creates a new HTML table object. If rows and columns
153 are specified, the table will be initialized to that
154 size. Row and Column numbers start at 1,1. 0,0 is
155 considered an empty table.
156  
157 If evenrowclass or oddrowclass is specified, these
158 classes will be applied to even and odd rows,
159 respectively, unless those rows have a specific class
160 applied to it.
161  
162 =back
163  
164 =head2 Table Level Methods
165  
166 =over 4
167  
168 =item setBorder([pixels])
169  
170 Sets the table Border Width
171  
172 =item setWidth([pixels|percentofscreen])
173  
174 Sets the table width
175  
176 $table->setWidth(500);
177 or
178 $table->setWidth('100%');
179  
180 =item setCellSpacing([pixels])
181  
182 =item setCellPadding([pixels])
183  
184 =item setCaption("CaptionText" [, top|bottom])
185  
186 =item setBGColor([colorname|colortriplet])
187  
188 =item autoGrow([1|true|on|anything|0|false|off|no|disable])
189  
190 Switches on (default) or off automatic growing of the table
191 if row or column values passed to setCell exceed current
192 table size.
193  
194 =item setAlign ( [ left , center , right ] )
195  
196 =item setRules ( [ rows , cols , all, both , groups ] )
197  
198 =item setStyle ( 'css style' )
199  
200 Sets the table style attribute.
201  
202 =item setClass ( 'css class' )
203  
204 Sets the table class attribute.
205  
206 =item setEvenRowClass ( 'css class' )
207  
208 Sets the class attribute of even rows in the table.
209  
210 =item setOddRowClass ( 'css class' )
211  
212 Sets the class attribute of odd rows in the table.
213  
214 =item setAttr ( 'user attribute' )
215  
216 Sets a user defined attribute for the table. Useful for when
217 HTML::Table hasn't implemented a particular attribute yet
218  
219 =item sort ( [sort_col_num, sort_type, sort_order, num_rows_to_skip] )
220  
221 or
222 sort( -sort_col => sort_col_num,
223 -sort_type => sort_type,
224 -sort_order => sort_order,
225 -skip_rows => num_rows_to_skip,
226 -strip_html => strip_html,
227 -strip_non_numeric => strip_non_numeric,
228 -presort_func => \&filter_func )
229  
230 sort_type in { ALPHA | NUMERIC },
231 sort_order in { ASC | DESC },
232 strip_html in { 0 | 1 }, defaults to 1,
233 strip_non_numeric in { 0 | 1 }, defaults to 1
234  
235 Sort all rows on a given column (optionally skipping table header rows
236 by specifiying num_rows_to_skip).
237  
238 By default sorting ignores HTML Tags and &nbsp, setting the strip_html parameter to 0
239 disables this behaviour.
240  
241 By default numeric Sorting ignores non numeric chararacters, setting the strip_non_numeric
242 parameter to 0 disables this behaviour.
243  
244 You can provide your own pre-sort function, useful for pre-processing the cell contents
245 before sorting for example dates.
246  
247  
248 =item getTableRows
249  
250 Returns the number of rows in the table.
251  
252 =item getTableCols
253  
254 Returns the number of columns in the table.
255  
256 =item getStyle
257  
258 Returns the table's style attribute.
259  
260 =back
261  
262 =head2 Section Level Methods
263  
264 =over 4
265  
266 =item setSectionId ( [tbody|thead|tfoot], section_num, 'id' )
267  
268 Sets the id attribute for the section.
269  
270 =item setSectionClass ( [tbody|thead|tfoot], section_num, 'class' )
271  
272 Sets the class attribute for the section.
273  
274 =item setSectionStyle ( [tbody|thead|tfoot], section_num, 'style' )
275  
276 Sets the style attribute for the section.
277  
278 =item setSectionAlign ( [tbody|thead|tfoot], section_num, [center|right|left] )
279  
280 Sets the horizontal alignment for the section.
281  
282 =item setSectionValign ( [tbody|thead|tfoot], section_num, [center|top|bottom|middle|baseline] )
283  
284 Sets the vertical alignment for the section.
285  
286 =item setSectionAttr ( [tbody|thead|tfoot], section_num, 'user attribute' )
287  
288 Sets a user defined attribute for the cell. Useful for when
289 HTML::Table hasn't implemented a particular attribute yet
290  
291 =back
292  
293 =head2 Cell Level Methods
294  
295 =over 4
296  
297 =item setCell(row_num, col_num, "content")
298  
299 Sets the content of a table cell. This could be any
300 string, even another table object via the getTable method.
301 If the row and/or column numbers are outside the existing table
302 boundaries extra rows and/or columns are created automatically.
303  
304 =item setSectionCell([tbody|thead|tfoot], section_num, row_num, col_num, "content")
305  
306 Same as setCell, but able to specify which section to act on.
307  
308 =item setCellAlign(row_num, col_num, [center|right|left])
309  
310 Sets the horizontal alignment for the cell.
311  
312 =item setSectionCellAlign([tbody|thead|tfoot], section_num, row_num, col_num, [center|right|left])
313  
314 Same as setCellAlign, but able to specify which section to act on.
315  
316 =item setCellVAlign(row_num, col_num, [center|top|bottom|middle|baseline])
317  
318 Sets the vertical alignment for the cell.
319  
320 =item setSectionCellVAlign([tbody|thead|tfoot], section_num, row_num, col_num, [center|top|bottom|middle|baseline])
321  
322 Same as setCellVAlign, but able to specify which section to act on.
323  
324 =item setCellWidth(row_num, col_num, [pixels|percentoftable])
325  
326 Sets the width of the cell.
327  
328 =item setSectionCellWidth([tbody|thead|tfoot], section_num, row_num, col_num, [pixels|percentoftable])
329  
330 Same as setCellWidth, but able to specify which section to act on.
331  
332 =item setCellHeight(row_num, col_num, [pixels])
333  
334 Sets the height of the cell.
335  
336 =item setSectionCellHeight([tbody|thead|tfoot], section_num, row_num, col_num, [pixels])
337  
338 Same as setCellHeight, but able to specify which section to act on.
339  
340 =item setCellHead(row_num, col_num, [0|1])
341  
342 Sets cell to be of type head (Ie <th></th>)
343  
344 =item setSectionCellHead([tbody|thead|tfoot], section_num, row_num, col_num, [0|1])
345  
346 Same as setCellHead, but able to specify which section to act on.
347  
348 =item setCellNoWrap(row_num, col_num, [0|1])
349  
350 Sets the NoWrap attribute of the cell.
351  
352 =item setSectionCellNoWrap([tbody|thead|tfoot], section_num, row_num, col_num, [0|1])
353  
354 Same as setCellNoWrap, but able to specify which section to act on.
355  
356 =item setCellBGColor(row_num, col_num, [colorname|colortriplet])
357  
358 Sets the background colour for the cell.
359  
360 =item setSectionCellBGColor([tbody|thead|tfoot], section_num, row_num, col_num, [colorname|colortriplet])
361  
362 Same as setCellBGColor, but able to specify which section to act on.
363  
364 =item setCellRowSpan(row_num, col_num, num_cells)
365  
366 Causes the cell to overlap a number of cells below it.
367 If the overlap number is greater than number of cells
368 below the cell, a false value will be returned.
369  
370 =item setSectionCellRowSpan([tbody|thead|tfoot], section_num, row_num, col_num, num_cells)
371  
372 Same as setCellRowSpan, but able to specify which section to act on.
373  
374 =item setCellColSpan(row_num, col_num, num_cells)
375  
376 Causes the cell to overlap a number of cells to the right.
377 If the overlap number is greater than number of cells to
378 the right of the cell, a false value will be returned.
379  
380 =item setSectionCellColSpan([tbody|thead|tfoot], section_num, row_num, col_num, num_cells)
381  
382 Same as setCellColSpan, but able to specify which section to act on.
383  
384 =item setCellSpan(row_num, col_num, num_rows, num_cols)
385  
386 Joins the block of cells with the starting cell specified.
387 The joined area will be num_cols wide and num_rows deep.
388  
389 =item setSectionCellSpan([tbody|thead|tfoot], section_num, row_num, col_num, num_rows, num_cols)
390  
391 Same as setCellSpan, but able to specify which section to act on.
392  
393 =item setCellFormat(row_num, col_num, start_string, end_string)
394  
395 Start_string should be a string of valid HTML, which is output before
396 the cell contents, end_string is valid HTML that is output after the cell contents.
397 This enables formatting to be applied to the cell contents.
398  
399 $table->setCellFormat(1, 2, '<b>', '</b>');
400
401 =item setSectionCellFormat([tbody|thead|tfoot], section_num, row_num, col_num, start_string, end_string)
402  
403 Same as setCellFormat, but able to specify which section to act on.
404  
405 =item setCellStyle (row_num, col_num, 'css style')
406  
407 Sets the cell style attribute.
408  
409 =item setSectionCellStyle([tbody|thead|tfoot], section_num, row_num, col_num, 'css style')
410  
411 Same as setCellStyle, but able to specify which section to act on.
412  
413 =item setCellClass (row_num, col_num, 'css class')
414  
415 Sets the cell class attribute.
416  
417 =item setSectionCellClass([tbody|thead|tfoot], section_num, row_num, col_num, 'css class')
418  
419 Same as setCellClass, but able to specify which section to act on.
420  
421 =item setCellAttr (row_num, col_num, 'user attribute')
422  
423 Sets a user defined attribute for the cell. Useful for when
424 HTML::Table hasn't implemented a particular attribute yet
425  
426 =item setSectionCellAttr([tbody|thead|tfoot], section_num, row_num, col_num, 'css class')
427  
428 Same as setCellAttr, but able to specify which section to act on.
429  
430 =item setLastCell*
431  
432 All of the setCell methods have a corresponding setLastCell method which
433 does not accept the row_num and col_num parameters, but automatically applies
434 to the last row and last col of the table.
435  
436 NB. Only works on the setCell* methods, not on the setSectionCell* methods.
437  
438 =item getCell(row_num, col_num)
439  
440 Returns the contents of the specified cell as a string.
441  
442 =item getSectionCell([tbody|thead|tfoot], section_num, row_num, col_num)
443  
444 Same as getCell, but able to specify which section to act on.
445  
446 =item getCellStyle(row_num, col_num)
447  
448 Returns cell's style attribute.
449  
450 =item getSectionCellStyle([tbody|thead|tfoot], section_num, row_num, col_num)
451  
452 Same as getCellStyle, but able to specify which section to act on.
453  
454 =back
455  
456 =head2 Column Level Methods
457  
458 =over 4
459  
460 =item addCol("cell 1 content" [, "cell 2 content", ...])
461  
462 Adds a column to the right end of the table. Assumes if
463 you pass more values than there are rows that you want
464 to increase the number of rows.
465  
466 =item addSectionCol([tbody|thead|tfoot], section_num, "cell 1 content" [, "cell 2 content", ...])
467  
468 Same as addCol, but able to specify which section to act on.
469  
470 =item setColAlign(col_num, [center|right|left])
471  
472 Applies setCellAlign over the entire column.
473  
474 =item setSectionColAlign([tbody|thead|tfoot], section_num, col_num, [center|right|left])
475  
476 Same as setColAlign, but able to specify which section to act on.
477  
478 =item setColVAlign(col_num, [center|top|bottom|middle|baseline])
479  
480 Applies setCellVAlign over the entire column.
481  
482 =item setSectionColVAlign([tbody|thead|tfoot], section_num, col_num, [center|top|bottom|middle|baseline])
483  
484 Same as setColVAlign, but able to specify which section to act on.
485  
486 =item setColWidth(col_num, [pixels|percentoftable])
487  
488 Applies setCellWidth over the entire column.
489  
490 =item setSectionColWidth([tbody|thead|tfoot], section_num, col_num, [pixels|percentoftable])
491  
492 Same as setColWidth, but able to specify which section to act on.
493  
494 =item setColHeight(col_num, [pixels])
495  
496 Applies setCellHeight over the entire column.
497  
498 =item setSectionColHeight([tbody|thead|tfoot], section_num, col_num, [pixels])
499  
500 Same as setColHeight, but able to specify which section to act on.
501  
502 =item setColHead(col_num, [0|1])
503  
504 Applies setCellHead over the entire column.
505  
506 =item setSectionColHead([tbody|thead|tfoot], section_num, col_num, [0|1])
507  
508 Same as setColHead, but able to specify which section to act on.
509  
510 =item setColNoWrap(col_num, [0|1])
511  
512 Applies setCellNoWrap over the entire column.
513  
514 =item setSectionColNoWrap([tbody|thead|tfoot], section_num, col_num, [0|1])
515  
516 Same as setColNoWrap, but able to specify which section to act on.
517  
518 =item setColBGColor(row_num, [colorname|colortriplet])
519  
520 Applies setCellBGColor over the entire column.
521  
522 =item setSectionColBGColor([tbody|thead|tfoot], section_num, col_num, [colorname|colortriplet])
523  
524 Same as setColBGColor, but able to specify which section to act on.
525  
526 =item setColFormat(col_num, start_string, end_sting)
527  
528 Applies setCellFormat over the entire column.
529  
530 =item setSectionColFormat([tbody|thead|tfoot], section_num, col_num, start_string, end_sting)
531  
532 Same as setColFormat, but able to specify which section to act on.
533  
534 =item setColStyle (col_num, 'css style')
535  
536 Applies setCellStyle over the entire column.
537  
538 =item setSectionColStyle([tbody|thead|tfoot], section_num, col_num, 'css style')
539  
540 Same as setColStyle, but able to specify which section to act on.
541  
542 =item setColClass (col_num, 'css class')
543  
544 Applies setCellClass over the entire column.
545  
546 =item setSectionColClass([tbody|thead|tfoot], section_num, col_num, 'css class')
547  
548 Same as setColClass, but able to specify which section to act on.
549  
550 =item setColAttr (col_num, 'user attribute')
551  
552 Applies setCellAttr over the entire column.
553  
554 =item setSectionColAttr([tbody|thead|tfoot], section_num, col_num, 'user attribute')
555  
556 Same as setColAttr, but able to specify which section to act on.
557  
558 =item setLastCol*
559  
560 All of the setCol methods have a corresponding setLastCol method which
561 does not accept the col_num parameter, but automatically applies
562 to the last col of the table.
563  
564 NB. Only works on the setCol* methods, not on the setSectionCol* methods.
565  
566 =item getColStyle(col_num)
567  
568 Returns column's style attribute. Only really useful after setting a column's style via setColStyle().
569  
570 =item getSectionColStyle([tbody|thead|tfoot], section_num, col_num)
571  
572 Same as getColStyle, but able to specify which section to act on.
573  
574 =back
575  
576 =head2 Row Level Methods
577  
578 =over 4
579  
580 =item addRow("cell 1 content" [, "cell 2 content", ...])
581  
582 Adds a row to the bottom of the first body section of the table.
583  
584 Adds a row to the bottom of the table. Assumes if you
585 pass more values than there are columns that you want
586 to increase the number of columns.
587  
588 =item addSectionRow([tbody|thead|tfoot], section_num, "cell 1 content" [, "cell 2 content", ...])
589  
590 Same as addRow, but able to specify which section to act on.
591  
592 =item delRow(row_num)
593  
594 Deletes a row from the first body section of the table. If -1 is passed as row_num, the
595 last row in the section will be deleted.
596  
597 =item delSectionRow([tbody|thead|tfoot], section_num, row_num)
598  
599 Same as delRow, but able to specify which section to act on.
600  
601 =item setRowAlign(row_num, [center|right|left])
602  
603 Sets the Align attribute of the row.
604  
605 =item setSectionRowAlign([tbody|thead|tfoot], section_num, row_num, [center|right|left])
606  
607 Same as setRowAlign, but able to specify which section to act on.
608  
609 =item setRowVAlign(row_num, [center|top|bottom|middle|baseline])
610  
611 Sets the VAlign attribute of the row.
612  
613 =item setSectionRowVAlign([tbody|thead|tfoot], section_num, row_num, [center|top|bottom|middle|baseline])
614  
615 Same as setRowVAlign, but able to specify which section to act on.
616  
617 =item setRowNoWrap(col_num, [0|1])
618  
619 Sets the NoWrap attribute of the row.
620  
621 =item setSectionRowNoWrap([tbody|thead|tfoot], section_num, row_num, [0|1])
622  
623 Same as setRowNoWrap, but able to specify which section to act on.
624  
625 =item setRowBGColor(row_num, [colorname|colortriplet])
626  
627 Sets the BGColor attribute of the row.
628  
629 =item setSectionRowBGColor([tbody|thead|tfoot], section_num, row_num, [colorname|colortriplet])
630  
631 Same as setRowBGColor, but able to specify which section to act on.
632  
633 =item setRowStyle (row_num, 'css style')
634  
635 Sets the Style attribute of the row.
636  
637 =item setSectionRowStyle([tbody|thead|tfoot], section_num, row_num, 'css style')
638  
639 Same as setRowStyle, but able to specify which section to act on.
640  
641 =item setRowClass (row_num, 'css class')
642  
643 Sets the Class attribute of the row.
644  
645 =item setSectionRowClass([tbody|thead|tfoot], section_num, row_num, 'css class')
646  
647 Same as setRowClass, but able to specify which section to act on.
648  
649 =item setRowAttr (row_num, 'user attribute')
650  
651 Sets the Attr attribute of the row.
652  
653 =item setSectionRowAttr([tbody|thead|tfoot], section_num, row_num, 'user attribute')
654  
655 Same as setRowAttr, but able to specify which section to act on.
656  
657  
658  
659 =item setRCellsWidth(row_num, [pixels|percentoftable])
660  
661 =item setRowWidth(row_num, [pixels|percentoftable]) ** Deprecated **
662  
663 Applies setCellWidth over the entire row.
664  
665 =item setSectionRCellsWidth([tbody|thead|tfoot], section_num, row_num, [pixels|percentoftable])
666  
667 =item setSectionRowWidth([tbody|thead|tfoot], section_num, row_num, [pixels|percentoftable]) ** Deprecated **
668  
669 Same as setRowWidth, but able to specify which section to act on.
670  
671 =item setRCellsHeight(row_num, [pixels])
672  
673 =item setRowHeight(row_num, [pixels]) ** Deprecated **
674  
675 Applies setCellHeight over the entire row.
676  
677 =item setSectionRCellsHeight([tbody|thead|tfoot], section_num, row_num, [pixels])
678  
679 =item setSectionRowHeight([tbody|thead|tfoot], section_num, row_num, [pixels]) ** Deprecated **
680  
681 Same as setRowHeight, but able to specify which section to act on.
682  
683 =item setRCellsHead(row_num, [0|1])
684  
685 =item setRowHead(row_num, [0|1]) ** Deprecated **
686  
687 Applies setCellHead over the entire row.
688  
689 =item setSectionRCellsHead([tbody|thead|tfoot], section_num, row_num, [0|1])
690  
691 =item setSectionRowHead([tbody|thead|tfoot], section_num, row_num, [0|1]) ** Deprecated **
692  
693 Same as setRowHead, but able to specify which section to act on.
694  
695 =item setRCellsFormat(row_num, start_string, end_string)
696  
697 =item setRowFormat(row_num, start_string, end_string) ** Deprecated **
698  
699 Applies setCellFormat over the entire row.
700  
701 =item setSectionRCellsFormat([tbody|thead|tfoot], section_num, row_num, start_string, end_string)
702  
703 =item setSectionRowFormat([tbody|thead|tfoot], section_num, row_num, start_string, end_string) ** Deprecated **
704  
705 Same as setRowFormat, but able to specify which section to act on.
706  
707  
708 =item setLastRow*
709  
710 All of the setRow methods have a corresponding setLastRow method which
711 does not accept the row_num parameter, but automatically applies
712 to the last row of the table.
713  
714 NB. Only works on the setRow* methods, not on the setSectionRow* methods.
715  
716 =item getRowStyle(row_num)
717  
718 Returns row's style attribute.
719  
720 =item getSectionRowStyle([tbody|thead|tfoot], section_num, row_num)
721  
722 Same as getRowStyle, but able to specify which section to act on.
723  
724 =back
725  
726 =head2 Output Methods
727  
728 =over 4
729  
730 =item getTable
731  
732 Returns a string containing the HTML representation
733 of the table.
734  
735 The same effect can also be achieved by using the object reference
736 in a string scalar context.
737  
738 For example...
739  
740 This code snippet:
741  
742 $table = new HTML::Table(2, 2);
743 print '<p>Start</p>';
744 print $table->getTable;
745 print '<p>End</p>';
746  
747 would produce the same output as:
748  
749 $table = new HTML::Table(2, 2);
750 print "<p>Start</p>$table<p>End</p>";
751  
752 =item print
753  
754 Prints HTML representation of the table to STDOUT
755  
756 =back
757  
758 =head1 CLASS VARIABLES
759  
760 =head1 HISTORY
761  
762 This module was originally created in 1997 by Stacy Lacy and whose last
763 version was uploaded to CPAN in 1998. The module was adopted in July 2000
764 by Anthony Peacock in order to distribute a revised version. This adoption
765 took place without the explicit consent of Stacy Lacy as it proved impossible
766 to contact them at the time. Explicit consent for the adoption has since been
767 received.
768  
769 =head1 AUTHOR
770  
771 Anthony Peacock, a.peacock@chime.ucl.ac.uk
772 Stacy Lacy (Original author)
773  
774 =head1 CONTRIBUTIONS
775  
776 Douglas Riordan <doug.riordan@gmail.com>
777 For get methods for Style attributes.
778  
779 Jay Flaherty, fty@mediapulse.com
780 For ROW, COL & CELL HEAD methods. Modified the new method to allow hash of values.
781  
782 John Stumbles, john@uk.stumbles.org
783 For autogrow behaviour of setCell, and allowing alignment specifications to be case insensitive
784  
785 Arno Teunisse, Arno.Teunisse@Simac.nl
786 For the methods adding rules, styles and table alignment attributes.
787  
788 Ville Skyttä, ville.skytta@iki.fi
789 For general fixes
790  
791 Paul Vernaza, vernaza@stwing.upenn.edu
792 For the setLast... methods
793  
794 David Link, dvlink@yahoo.com
795 For the sort method
796  
797 Tommi Maekitalo, t.maekitalo@epgmbh.de
798 For adding the 'head' parameter to the new method and for adding the initialisation from an array ref
799 to the new method.
800  
801 Chris Weyl, cweyl@alumni.drew.edu
802 For adding the even/odd row class support.
803  
804 =head1 COPYRIGHT
805  
806 Copyright (c) 2000-2007 Anthony Peacock, CHIME.
807 Copyright (c) 1997 Stacy Lacy
808  
809 This library is free software; you can redistribute it and/or
810 modify it under the same terms as Perl itself.
811  
812 =head1 SEE ALSO
813  
814 perl(1), CGI(3)
815  
816 =cut
817  
818 #-------------------------------------------------------
819 # Subroutine: new([num_rows, num_cols])
820 # or new([-rows=>num_rows,
821 # -cols=>num_cols,
822 # -border=>border_width,
823 # -bgcolor=>back_colour,
824 # -width=>table_width,
825 # -spacing=>cell_spacing,
826 # -padding=>cell_padding]);
827 # Author: Stacy Lacy
828 # Date: 30 Jul 1997
829 # Modified: 30 Mar 1998 - Jay Flaherty
830 # Modified: 13 Feb 2001 - Anthony Peacock
831 # Modified: 30 Aug 2002 - Tommi Maekitalo
832 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
833 # Modified: 25 May 2007 - Chris Weyl (even/odd row class support)
834 #-------------------------------------------------------
835 0 ▶sub new {
Subroutine new: not called CC=31 SCAR=69.0
Pod documented
836  
837 # Creates new table instance
838 0 my $type = shift;
839 0 ▶my $class = ref($type) || $type;
Condition0%0/3
ref $type || $type
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $type || $type
ref $type $type
Truth table0%0/3
A || B
A= ref $typeB= $type
ABresult
1X1
011
000
840 0 my $self = {};
841 0 bless( $self, $class);
842  
843 # If paramter list is a hash (of the form -param=>value, ...)
844 0 ▶if (defined $_[0] && $_[0] =~ /^-/) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $_[0] and $_[0] =~ /^-/) { } 0 0 0
elsif (ref $_[0]) { } 0 0 0
Condition0%0/3
defined $_[0] and $_[0] =~ /^-/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^-/
defined $_[0] $_[0] =~ /^-/
Truth table0%0/3
A and B
A= defined $_[0]B= $_[0] =~ /^-/
ABresult
0X0
100
111
845 0 my %flags = @_;
846 0 ▶ $self->{border} = defined $flags{-border} && _is_validnum($flags{-border}) ? $flags{-border} : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $flags{'-border'} && _is_validnum($flags{'-border'}) ? : 0 0 0
Condition0%0/3
defined $flags{"-border"} and _is_validnum($flags{"-border"})
!ll&&!rl&&r
000
MC/DC0%0/2
defined $flags{"-border"} and _is_validnum($flags{"-border"})
defined $flags{"-border"} _is_validnum($flags{"-border"})
Truth table0%0/3
A and B
A= defined $flags{"-border"}B= _is_validnum($flags{"-border"})
ABresult
0X0
100
111
847 0 ▶ $self->{align} = $flags{-align} || undef;
Condition0%0/2
$flags{'-align'} || undef
l!l
00
MC/DC0%0/1
$flags{'-align'} || undef
$flags{'-align'}
Truth table0%0/2
A
A= $flags{'-align'}
Aresult
11
00
848 0 ▶ $self->{rules} = $flags{-rules} || undef;
Condition0%0/2
$flags{'-rules'} || undef
l!l
00
MC/DC0%0/1
$flags{'-rules'} || undef
$flags{'-rules'}
Truth table0%0/2
A
A= $flags{'-rules'}
Aresult
11
00
849 0 ▶ $self->{style} = $flags{-style} || undef;
Condition0%0/2
$flags{'-style'} || undef
l!l
00
MC/DC0%0/1
$flags{'-style'} || undef
$flags{'-style'}
Truth table0%0/2
A
A= $flags{'-style'}
Aresult
11
00
850 0 ▶ $self->{class} = $flags{-class} || undef;
Condition0%0/2
$flags{'-class'} || undef
l!l
00
MC/DC0%0/1
$flags{'-class'} || undef
$flags{'-class'}
Truth table0%0/2
A
A= $flags{'-class'}
Aresult
11
00
851 0 ▶ $self->{bgcolor} = $flags{-bgcolor} || undef;
Condition0%0/2
$flags{'-bgcolor'} || undef
l!l
00
MC/DC0%0/1
$flags{'-bgcolor'} || undef
$flags{'-bgcolor'}
Truth table0%0/2
A
A= $flags{'-bgcolor'}
Aresult
11
00
852 0 ▶ $self->{background} = $flags{-background} || undef;
Condition0%0/2
$flags{'-background'} || undef
l!l
00
MC/DC0%0/1
$flags{'-background'} || undef
$flags{'-background'}
Truth table0%0/2
A
A= $flags{'-background'}
Aresult
11
00
853 0 ▶ $self->{width} = $flags{-width} || undef;
Condition0%0/2
$flags{'-width'} || undef
l!l
00
MC/DC0%0/1
$flags{'-width'} || undef
$flags{'-width'}
Truth table0%0/2
A
A= $flags{'-width'}
Aresult
11
00
854 0 ▶ $self->{cellspacing} = defined $flags{-spacing} && _is_validnum($flags{-spacing}) ? $flags{-spacing} : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $flags{'-spacing'} && _is_validnum($flags{'-spacing'}) ? : 0 0 0
Condition0%0/3
defined $flags{"-spacing"} and _is_validnum($flags{"-spacing"})
!ll&&!rl&&r
000
MC/DC0%0/2
defined $flags{"-spacing"} and _is_validnum($flags{"-spacing"})
defined $flags{"-spacing"} _is_validnum($flags{"-spacing"})
Truth table0%0/3
A and B
A= defined $flags{"-spacing"}B= _is_validnum($flags{"-spacing"})
ABresult
0X0
100
111
855 0 ▶ $self->{cellpadding} = defined $flags{-padding} && _is_validnum($flags{-padding}) ? $flags{-padding} : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $flags{'-padding'} && _is_validnum($flags{'-padding'}) ? : 0 0 0
Condition0%0/3
defined $flags{"-padding"} and _is_validnum($flags{"-padding"})
!ll&&!rl&&r
000
MC/DC0%0/2
defined $flags{"-padding"} and _is_validnum($flags{"-padding"})
defined $flags{"-padding"} _is_validnum($flags{"-padding"})
Truth table0%0/3
A and B
A= defined $flags{"-padding"}B= _is_validnum($flags{"-padding"})
ABresult
0X0
100
111
856 0 ▶ $self->{last_col} = $flags{-cols} || 0;
Condition0%0/2
$flags{'-cols'} || 0
l!l
00
MC/DC0%0/1
$flags{'-cols'} || 0
$flags{'-cols'}
Truth table0%0/2
A
A= $flags{'-cols'}
Aresult
11
00
857 0 ▶ $self->{evenrowclass} = $flags{-evenrowclass} || undef;
Condition0%0/2
$flags{'-evenrowclass'} || undef
l!l
00
MC/DC0%0/1
$flags{'-evenrowclass'} || undef
$flags{'-evenrowclass'}
Truth table0%0/2
A
A= $flags{'-evenrowclass'}
Aresult
11
00
858 0 ▶ $self->{oddrowclass} = $flags{-oddrowclass} || undef;
Condition0%0/2
$flags{'-oddrowclass'} || undef
l!l
00
MC/DC0%0/1
$flags{'-oddrowclass'} || undef
$flags{'-oddrowclass'}
Truth table0%0/2
A
A= $flags{'-oddrowclass'}
Aresult
11
00
859  
860 0 ▶ if ($flags{-head})
Branch: 1 branch
BranchTrueFalseTotal
if ($flags{"-head"}) 0 0 0
861 {
862 0 $self->addRow(@{$flags{-head}});
863 0 $self->setRowHead(1);
864 }
865  
866 0 ▶ if ($flags{-data})
Branch: 1 branch
BranchTrueFalseTotal
if ($flags{"-data"}) 0 0 0
867 {
868 0 foreach (@{$flags{-data}})
869 {
870 0 $self->addRow(@$_);
871 }
872 }
873  
874 0 ▶ if ($self->{tbody}[0]->{last_row}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'tbody'}[0]{'last_row'}) { } 0 0 0
875 0 ▶ $self->{tbody}[0]->{last_row} = $flags{-rows} if (defined $flags{-rows} && $self->{tbody}[0]->{last_row} < $flags{-rows});
Branch: 1 branch
BranchTrueFalseTotal
if defined $flags{"-rows"} and $self->{"tbody"}[0]{"last_row"} < $flags{"-rows"} 0 0 0
Condition0%0/3
defined $flags{"-rows"} and $self->{"tbody"}[0]{"last_row"} < $flags{"-rows"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $flags{"-rows"} and $self->{"tbody"}[0]{"last_row"} < $flags{"-rows"}
defined $flags{"-rows"} $self->{"tbody"}[0]{"last_row"} < $flags{"-rows"}
Truth table0%0/3
A and B
A= defined $flags{"-rows"}B= $self->{"tbody"}[0]{"last_row"} < $flags{"-rows"}
ABresult
0X0
100
111
876 } else {
877 0 ▶ $self->{tbody}[0]->{last_row} = $flags{-rows} || 0;
Condition0%0/2
$flags{'-rows'} || 0
l!l
00
MC/DC0%0/1
$flags{'-rows'} || 0
$flags{'-rows'}
Truth table0%0/2
A
A= $flags{'-rows'}
Aresult
11
00
878 }
879  
880 }
881 elsif (ref $_[0])
882 {
883 # Array-reference [ ['row0col0', 'row0col1'], ['row1col0', 'row1col1'] ]
884 0 $self->{tbody}[0]->{last_row} = 0;
885 0 $self->{last_col} = 0;
886 0 foreach (@{$_[0]})
887 {
888 0 $self->addRow(@$_);
889 }
890  
891 }
892 else # user supplied row and col (or default to 0,0)
893 {
894 0 ▶ $self->{tbody}[0]->{last_row} = shift || 0;
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
895 0 ▶ $self->{last_col} = shift || 0;
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
896 }
897  
898 # Table Auto-Grow mode (default on)
899 0 $self->{autogrow} = 1;
900  
901 0 return $self;
902 }
903  
904 #-------------------------------------------------------
905 # Subroutine: getTable
906 # Author: Stacy Lacy
907 # Date: 30 July 1997
908 # Modified: 19 Mar 1998 - Jay Flaherty
909 # Modified: 13 Feb 2001 - Anthony Peacock
910 # Modified: 23 Oct 2001 - Terence Brown
911 # Modified: 05 Jan 2002 - Arno Teunisse
912 # Modified: 10 Jan 2002 - Anthony Peacock
913 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
914 # Modified: 25 May 2007 - Chris Weyl (add even/odd row class support)
915 # Modified: 10 Sept 2007 - Anthony Peacock
916 #-------------------------------------------------------
917 0 ▶sub getTable {
Subroutine getTable: not called CC=19 SCAR=59.4
Pod documented
918 0 my $self = shift;
919 0 my $html="";
920  
921 # this sub returns HTML version of the table object
922 0 ▶ if ((! $self->{tbody}[0]{last_row}) || (! $self->{last_col})) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"tbody"}[0]{"last_row"} and $self->{"last_col"}) 0 0 0
Condition0%0/3
$self->{"tbody"}[0]{"last_row"} and $self->{"last_col"}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"tbody"}[0]{"last_row"} and $self->{"last_col"}
$self->{"tbody"}[0]{"last_row"} $self->{"last_col"}
Truth table0%0/3
A and B
A= $self->{"tbody"}[0]{"last_row"}B= $self->{"last_col"}
ABresult
0X0
100
111
923 0 return ; # no rows or no cols
924 }
925  
926 # Table tag
927 0 $html .="\n<table";
928 0 ▶ $html .=" border=\"$self->{border}\"" if defined $self->{border};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"border"} 0 0 0
929 0 ▶ $html .=" cellspacing=\"$self->{cellspacing}\"" if defined $self->{cellspacing};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"cellspacing"} 0 0 0
930 0 ▶ $html .=" cellpadding=\"$self->{cellpadding}\"" if defined $self->{cellpadding};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"cellpadding"} 0 0 0
931 0 ▶ $html .=" width=\"$self->{width}\"" if defined $self->{width};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"width"} 0 0 0
932 0 ▶ $html .=" bgcolor=\"$self->{bgcolor}\"" if defined $self->{bgcolor};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"bgcolor"} 0 0 0
933 0 ▶ $html .=" background=\"$self->{background}\"" if defined $self->{background};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"background"} 0 0 0
934 0 ▶ $html .=" rules=\"$self->{rules}\"" if defined $self->{rules} ; # add rules for table
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"rules"} 0 0 0
935 0 ▶ $html .=" align=\"$self->{align}\"" if defined $self->{align} ; # alignment of the table
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"align"} 0 0 0
936 0 ▶ $html .=" style=\"$self->{style}\"" if defined $self->{style} ; # style for the table
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"style"} 0 0 0
937 0 ▶ $html .=" class=\"$self->{class}\"" if defined $self->{class} ; # class for the table
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"class"} 0 0 0
938 0 ▶ $html .=" $self->{attr}" if defined $self->{attr} ; # user defined attribute string
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"attr"} 0 0 0
939 0 $html .=">\n";
940 0 ▶ if (defined $self->{caption}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"caption"}) 0 0 0
941 0 $html .="<caption";
942 0 ▶ $html .=" align=\"$self->{caption_align}\"" if (defined $self->{caption_align});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"caption_align"} 0 0 0
943 0 $html .=">$self->{caption}</caption>\n";
944 }
945  
946 # thead tag (if defined)
947 0 ▶ if (defined $self->{thead}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"thead"}) 0 0 0
948 0 $html .= $self->getSection ( 'thead', 0 );
949 }
950
951 # TFOOT tag (if defined)
952 0 ▶ if (defined $self->{tfoot}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"tfoot"}) 0 0 0
953 0 $html .= $self->getSection ( 'tfoot', 0 );
954 }
955
956 # Body sections
957 0 my $num_sections = @{$self->{tbody}} - 1;
958 0 for my $j ( 0..$num_sections ) {
959 0 $html .= $self->getSection ( 'tbody', $j );
960 }
961
962 # Close TABLE tag
963 0 $html .="</table>\n";
964  
965 0 return ($html);
966 }
967  
968 #-------------------------------------------------------
969 # Subroutine: getRow
970 # Author: Anthony Peacock
971 # Date: 10 September 2007
972 # Description: Gets the HTML to form a row, based on code taken from getTable
973 #-------------------------------------------------------
974 0 ▶sub getRow {
Subroutine getRow: not called CC=31 SCAR=69.0
Pod undocumented
975 0 my $self = shift;
976 0 my $section = lc(shift);
977 0 my $sect_num = shift;
978 0 my $row_num = shift;
979 0 my $html="";
980  
981 # Print each row of the table
982 0 $html .="<tr" ;
983  
984 # Set the row attributes (if any)
985 0 ▶ $html .= ' bgcolor="' . $self->{$section}[$sect_num]->{rows}[$row_num]->{bgcolor} . '"' if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{bgcolor};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"bgcolor"} 0 0 0
986 0 ▶ $html .= ' align="' . $self->{$section}[$sect_num]->{rows}[$row_num]->{align} . '"' if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{align};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"align"} 0 0 0
987 0 ▶ $html .= ' valign="' . $self->{$section}[$sect_num]->{rows}[$row_num]->{valign} . '"' if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{valign} ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"valign"} 0 0 0
988 0 ▶ $html .= ' style="' . $self->{$section}[$sect_num]->{rows}[$row_num]->{style} . '"' if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{style} ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"style"} 0 0 0
989 $html .= defined $self->{$section}[$sect_num]->{rows}[$row_num]->{class} ? ' class="' . $self->{$section}[$sect_num]->{rows}[$row_num]->{class} . '"'
990 : defined $self->{evenrowclass} && ($row_num % 2 == 0) ? ' class="' . $self->{evenrowclass} . '"'
991 0 ▶ : defined $self->{oddrowclass} && ($row_num % 2 == 1) ? ' class="' . $self->{oddrowclass} . '"'
Branch: 3 branches
BranchTrueFalseTotal
defined $self->{$section}[$sect_num]{'rows'}[$row_num]{'class'} ? : 0 0 0
defined $self->{'evenrowclass'} && $row_num % 2 == 0 ? : 0 0 0
defined $self->{'oddrowclass'} && $row_num % 2 == 1 ? : 0 0 0
Condition0%0/6
defined $self->{"evenrowclass"} and $row_num % 2 == 0
!ll&&!rl&&r
000
defined $self->{"oddrowclass"} and $row_num % 2 == 1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"evenrowclass"} and $row_num % 2 == 0
defined $self->{"evenrowclass"} $row_num % 2 == 0
MC/DC0%0/2
defined $self->{"oddrowclass"} and $row_num % 2 == 1
defined $self->{"oddrowclass"} $row_num % 2 == 1
Truth table0%0/3
A and B
A= defined $self->{"evenrowclass"}B= $row_num % 2 == 0
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $self->{"oddrowclass"}B= $row_num % 2 == 1
ABresult
0X0
100
111
992 : q{};
993 0 ▶ $html .= ' nowrap="' . $self->{$section}[$sect_num]->{rows}[$row_num]->{nowrap} . '"' if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{nowrap} ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"nowrap"} 0 0 0
994 0 ▶ $html .= " $self->{$section}[$sect_num]->{rows}[$row_num]->{attr}" if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{attr} ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"attr"} 0 0 0
995 0 $html .= ">" ; # Closing tr tag
996
997 0 my $j;
998 0 ▶ for ($j=1; $j <= ($self->{last_col}); $j++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j <= $self->{"last_col"}) 0 0 0
999
1000 0 ▶ if (defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{colspan} && $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{colspan} eq "SPANNED"){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"} and $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"} eq "SPANNED") 0 0 0
Condition0%0/3
defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"} and $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"} eq "SPANNED"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"} and $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"} eq "SPANNED"
defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"} $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"} eq "SPANNED"
Truth table0%0/3
A and B
A= defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"}B= $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"} eq "SPANNED"
ABresult
0X0
100
111
1001 0 $html.="<!-- spanned cell -->";
1002 next
1003 0 }
1004
1005 # print cell
1006 # if head flag is set print <th> tag else <td>
1007 0 ▶ if (defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{head}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{$section}[$sect_num]{'rows'}[$row_num]{'cells'}[$j]{'head'}) { } 0 0 0
1008 0 $html .="<th";
1009 } else {
1010 0 $html .="<td";
1011 }
1012  
1013 # if alignment options are set, add them in the cell tag
1014 $html .=' align="' . $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{align} . '"'
1015 0 ▶ if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{align};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"align"} 0 0 0
1016
1017 $html .=" valign=\"" . $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{valign} . "\""
1018 0 ▶ if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{valign};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"valign"} 0 0 0
1019
1020 # apply custom height and width to the cell tag
1021 $html .=" width=\"" . $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{width} . "\""
1022 0 ▶ if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{width};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"width"} 0 0 0
1023
1024 $html .=" height=\"" . $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{height} . "\""
1025 0 ▶ if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{height};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"height"} 0 0 0
1026
1027 # apply background color if set
1028 $html .=" bgcolor=\"" . $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{bgcolor} . "\""
1029 0 ▶ if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{bgcolor};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"bgcolor"} 0 0 0
1030  
1031 # apply style if set
1032 $html .=" style=\"" . $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{style} . "\""
1033 0 ▶ if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{style};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"style"} 0 0 0
1034  
1035 # apply class if set
1036 $html .=" class=\"" . $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{class} . "\""
1037 0 ▶ if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{class};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"class"} 0 0 0
1038  
1039 # User defined attribute
1040 $html .=" " . $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{attr}
1041 0 ▶ if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{attr};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"attr"} 0 0 0
1042  
1043 # if nowrap mask is set, put it in the cell tag
1044 0 ▶ $html .=" nowrap" if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{nowrap};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"nowrap"} 0 0 0
1045
1046 # if column/row spanning is set, put it in the cell tag
1047 # also increment to skip spanned rows/cols.
1048 0 ▶ if (defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{colspan}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"colspan"}) 0 0 0
1049 0 $html .=" colspan=\"" . $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{colspan} ."\"";
1050 }
1051 0 ▶ if (defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{rowspan}){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"rowspan"}) 0 0 0
1052 0 $html .=" rowspan=\"" . $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{rowspan} ."\"";
1053 }
1054
1055 # Finish up Cell by ending cell start tag, putting content and cell end tag
1056 0 $html .=">";
1057 0 ▶ $html .= $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{startformat} if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{startformat} ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"startformat"} 0 0 0
1058 0 ▶ $html .= $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{contents} if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{contents};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"contents"} 0 0 0
1059 0 ▶ $html .= $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{endformat} if defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{endformat} ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"rows"}[$row_num]{"cells"}[$j]{"endformat"} 0 0 0
1060
1061 # if head flag is set print </th> tag else </td>
1062 0 ▶ if (defined $self->{$section}[$sect_num]->{rows}[$row_num]->{cells}[$j]->{head}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{$section}[$sect_num]{'rows'}[$row_num]{'cells'}[$j]{'head'}) { } 0 0 0
1063 0 $html .= "</th>";
1064 } else {
1065 0 $html .= "</td>";
1066 }
1067 }
1068 0 $html .="</tr>\n";
1069  
1070 0 return ($html);
1071 }
1072  
1073 #-------------------------------------------------------
1074 # Subroutine: getSection
1075 # Author: Anthony Peacock
1076 # Date: 10 April 2008
1077 # Description: Gets the HTML to form a section
1078 #-------------------------------------------------------
1079 0 ▶sub getSection {
Subroutine getSection: not called CC=9 SCAR=45.0
Pod undocumented
1080 0 my $self = shift;
1081 0 my $section = lc(shift);
1082 0 my $sect_num = shift;
1083 0 my $html="";
1084  
1085 # Create section HTML
1086 0 $html .= "<$section";
1087
1088 # Set the section attributes (if any)
1089 0 ▶ $html .= ' id="' . $self->{$section}[$sect_num]->{id} . '"' if defined $self->{$section}[$sect_num]->{id};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"id"} 0 0 0
1090 0 ▶ $html .= ' title="' . $self->{$section}[$sect_num]->{title} . '"' if defined $self->{$section}[$sect_num]->{title};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"title"} 0 0 0
1091 0 ▶ $html .= ' class="' . $self->{$section}[$sect_num]->{class} . '"' if defined $self->{$section}[$sect_num]->{class};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"class"} 0 0 0
1092 0 ▶ $html .= ' style="' . $self->{$section}[$sect_num]->{style} . '"' if defined $self->{$section}[$sect_num]->{style};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"style"} 0 0 0
1093 0 ▶ $html .= ' align="' . $self->{$section}[$sect_num]->{align} . '"' if defined $self->{$section}[$sect_num]->{align};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"align"} 0 0 0
1094 0 ▶ $html .= ' valign="' . $self->{$section}[$sect_num]->{valign} . '"' if defined $self->{$section}[$sect_num]->{valign};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"valign"} 0 0 0
1095 0 ▶ $html .= ' attr="' . $self->{$section}[$sect_num]->{attr} . '"' if defined $self->{$section}[$sect_num]->{attr};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$section}[$sect_num]{"attr"} 0 0 0
1096
1097 0 $html .= ">\n";
1098
1099 0 for my $i ( 1..($self->{$section}[$sect_num]->{last_row})){
1100 # Print each row
1101 0 $html .= $self->getRow($section, $sect_num, $i);
1102 }
1103 0 $html .= "</$section>\n";
1104
1105  
1106 0 return ($html);
1107 }
1108
1109 #-------------------------------------------------------
1110 # Subroutine: print
1111 # Author: Stacy Lacy
1112 # Date: 30 Jul 1997
1113 #-------------------------------------------------------
1114 0 ▶sub print {
Subroutine print: not called CC=1 SCAR=6.9
Pod documented
1115 0 my $self = shift;
1116 0 print $self->getTable;
1117 }
1118  
1119 #-------------------------------------------------------
1120 # Subroutine: autoGrow([1|on|true|0|off|false])
1121 # Author: John Stumbles
1122 # Date: 08 Feb 2001
1123 # Description: switches on (default) or off auto-grow mode
1124 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1125 #-------------------------------------------------------
1126 0 ▶sub autoGrow {
Subroutine autoGrow: not called CC=3 SCAR=24.8
Pod documented
1127 0 my $self = shift;
1128 0 $self->{autogrow} = shift;
1129 0 ▶ if ( defined $self->{autogrow} && $self->{autogrow} =~ /^(?:no|off|false|disable|0)$/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'autogrow'} and $self->{'autogrow'} =~ /^(?:no|off|false|disable|0)$/i) { } 0 0 0
Condition0%0/3
defined $self->{"autogrow"} and $self->{"autogrow"} =~ /^(?:no|off|false|disable|0)$/i
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"autogrow"} and $self->{"autogrow"} =~ /^(?:no|off|false|disable|0)$/i
defined $self->{"autogrow"} $self->{"autogrow"} =~ /^(?:no|off|false|disable|0)$/i
Truth table0%0/3
A and B
A= defined $self->{"autogrow"}B= $self->{"autogrow"} =~ /^(?:no|off|false|disable|0)$/i
ABresult
0X0
100
111
1130 0 $self->{autogrow} = 0;
1131 } else {
1132 0 $self->{autogrow} = 1;
1133 }
1134 }
1135  
1136  
1137 #-------------------------------------------------------
1138 # Table config methods
1139 #
1140 #-------------------------------------------------------
1141  
1142 #-------------------------------------------------------
1143 # Subroutine: setBorder([pixels])
1144 # Author: Stacy Lacy
1145 # Date: 30 Jul 1997
1146 # Modified: 12 Jul 2000 - Anthony Peacock (To allow zero values)
1147 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1148 #-------------------------------------------------------
1149 0 ▶sub setBorder {
Subroutine setBorder: not called CC=2 SCAR=17.9
Pod documented
1150 0 my $self = shift;
1151 0 $self->{border} = shift;
1152 0 ▶ $self->{border} = 1 unless ( &_is_validnum($self->{border}) ) ;
Branch: 1 branch
BranchTrueFalseTotal
unless &_is_validnum($self->{"border"}) 0 0 0
1153 }
1154  
1155 #-------------------------------------------------------
1156 # Subroutine: setBGColor([colorname|colortriplet])
1157 # Author: Stacy Lacy
1158 # Date: 30 Jul 1997
1159 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1160 #-------------------------------------------------------
1161 0 ▶sub setBGColor {
Subroutine setBGColor: not called CC=2 SCAR=17.9
Pod documented
1162 0 my $self = shift;
1163 0 ▶ $self->{bgcolor} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1164 }
1165  
1166 #-------------------------------------------------------
1167 # Subroutine: setStyle(css style)
1168 # Author: Anthony Peacock
1169 # Date: 6 Mar 2002
1170 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1171 #-------------------------------------------------------
1172 0 ▶sub setStyle {
Subroutine setStyle: not called CC=2 SCAR=17.9
Pod documented
1173 0 my $self = shift;
1174 0 ▶ $self->{style} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1175 }
1176  
1177 #-------------------------------------------------------
1178 # Subroutine: setClass(css class)
1179 # Author: Anthony Peacock
1180 # Date: 22 July 2002
1181 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1182 #-------------------------------------------------------
1183 0 ▶sub setClass {
Subroutine setClass: not called CC=2 SCAR=17.9
Pod documented
1184 0 my $self = shift;
1185 0 ▶ $self->{class} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1186 }
1187  
1188 #-------------------------------------------------------
1189 # Subroutine: setEvenRowClass(css class)
1190 # Author: Chris Weyl
1191 # Date: 25 May 2007
1192 #-------------------------------------------------------
1193 0 ▶sub setEvenRowClass {
Subroutine setEvenRowClass: not called CC=2 SCAR=17.9
Pod documented
1194 0 my $self = shift;
1195 0 ▶ $self->{evenrowclass} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1196 }
1197  
1198 #-------------------------------------------------------
1199 # Subroutine: setOddRowClass(css class)
1200 # Author: Chris Weyl
1201 # Date: 25 May 2007
1202 #-------------------------------------------------------
1203 0 ▶sub setOddRowClass {
Subroutine setOddRowClass: not called CC=2 SCAR=17.9
Pod documented
1204 0 my $self = shift;
1205 0 ▶ $self->{oddrowclass} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1206 }
1207  
1208 #-------------------------------------------------------
1209 # Subroutine: setWidth([pixels|percentofscreen])
1210 # Author: Stacy Lacy
1211 # Date: 30 Jul 1997
1212 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1213 #-------------------------------------------------------
1214 0 ▶sub setWidth {
Subroutine setWidth: not called CC=2 SCAR=17.9
Pod documented
1215 0 my $self = shift;
1216 0 my $value = shift;
1217
1218 0 ▶ if ( $value !~ /^\s*\d+%?/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value =~ /^\s*\d+%?/) { } 0 0 0
1219 0 print STDERR "$0:setWidth:Invalid value $value\n";
1220 0 return 0;
1221 } else {
1222 0 $self->{width} = $value;
1223 }
1224 }
1225  
1226 #-------------------------------------------------------
1227 # Subroutine: setCellSpacing([pixels])
1228 # Author: Stacy Lacy
1229 # Date: 30 Jul 1997
1230 # Modified: 12 Jul 2000 - Anthony Peacock (To allow zero values)
1231 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1232 #-------------------------------------------------------
1233 0 ▶sub setCellSpacing {
Subroutine setCellSpacing: not called CC=2 SCAR=17.9
Pod documented
1234 0 my $self = shift;
1235 0 $self->{cellspacing} = shift;
1236 0 ▶ $self->{cellspacing} = 1 unless ( &_is_validnum($self->{cellspacing}) ) ;
Branch: 1 branch
BranchTrueFalseTotal
unless &_is_validnum($self->{"cellspacing"}) 0 0 0
1237 }
1238  
1239 #-------------------------------------------------------
1240 # Subroutine: setCellPadding([pixels])
1241 # Author: Stacy Lacy
1242 # Date: 30 Jul 1997
1243 # Modified: 12 Jul 2000 - Anthony Peacock (To allow zero values)
1244 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1245 #-------------------------------------------------------
1246 0 ▶sub setCellPadding {
Subroutine setCellPadding: not called CC=2 SCAR=17.9
Pod documented
1247 0 my $self = shift;
1248 0 $self->{cellpadding} = shift;
1249 0 ▶ $self->{cellpadding} = 1 unless ( &_is_validnum($self->{cellpadding}) ) ;
Branch: 1 branch
BranchTrueFalseTotal
unless &_is_validnum($self->{"cellpadding"}) 0 0 0
1250 }
1251  
1252 #-------------------------------------------------------
1253 # Subroutine: setCaption("CaptionText" [, "TOP|BOTTOM])
1254 # Author: Stacy Lacy
1255 # Date: 30 Jul 1997
1256 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1257 #-------------------------------------------------------
1258 0 ▶sub setCaption {
Subroutine setCaption: not called CC=4 SCAR=30.0
Pod documented
1259 0 my $self = shift;
1260 0 $self->{caption} = shift ;
1261 0 my $align = lc(shift);
1262 0 ▶ if (defined $align && (($align eq 'top') || ($align eq 'bottom')) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $align and $align eq 'top' || $align eq 'bottom') { } 0 0 0
Condition0%0/6
defined $align and $align eq "top" || $align eq "bottom"
!ll&&!rl&&r
000
$align eq "top" or $align eq "bottom"
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $align and $align eq "top" || $align eq "bottom"
defined $align $align eq "top" $align eq "bottom"
Truth table0%0/4
A and B or C
A= defined $alignB= $align eq "top"C= $align eq "bottom"
ABCresult
0XX0
1000
11X1
1011
1263 0 $self->{caption_align} = $align;
1264 } else {
1265 0 $self->{caption_align} = 'top';
1266 }
1267 }
1268  
1269 #-------------------------------------------------------
1270 # Subroutine: setAlign([left|right|center])
1271 # Author: Arno Teunisse ( freely copied from setBGColor
1272 # Date: 05 Jan 2002
1273 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1274 #-------------------------------------------------------
1275 0 ▶sub setAlign {
Subroutine setAlign: not called CC=2 SCAR=17.9
Pod documented
1276 0 my $self = shift;
1277 0 ▶ $self->{align} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1278 }
1279  
1280 #-------------------------------------------------------
1281 # Subroutine: setRules([left|right|center])
1282 # Author: Arno Teunisse ( freely copied from setBGColor
1283 # Date: 05 Jan 2002
1284 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1285 # parameter [ none | groups | rows| cols | all ]
1286 #-------------------------------------------------------
1287 0 ▶sub setRules {
Subroutine setRules: not called CC=2 SCAR=17.9
Pod documented
1288 0 my $self = shift;
1289 0 ▶ $self->{rules} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1290 }
1291  
1292 #-------------------------------------------------------
1293 # Subroutine: setAttr("attribute string")
1294 # Author: Anthony Peacock
1295 # Date: 10 Jan 2002
1296 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1297 #-------------------------------------------------------
1298 0 ▶sub setAttr {
Subroutine setAttr: not called CC=2 SCAR=17.9
Pod documented
1299 0 my $self = shift;
1300 0 ▶ $self->{attr} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1301 }
1302  
1303 #-------------------------------------------------------
1304 # Subroutine: getSectionTableRows ('section', section_num')
1305 # Author: Anthony Peacock
1306 # Date: 12 Sept 2007
1307 # Based on: getTableRows
1308 #-------------------------------------------------------
1309 0 ▶sub getSectionTableRows {
Subroutine getSectionTableRows: not called CC=4 SCAR=30.0
Pod undocumented
1310 0 my $self = shift;
1311 0 my $section = shift;
1312 0 my $section_num = shift;
1313
1314 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1315 0 print STDERR "\ngetSectionTableRows: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1316 0 return 0;
1317 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1318 0 print STDERR "\ngetSectionTableRows: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1319 0 return 0;
1320 }
1321
1322 0 return $self->{$section}[$section_num]->{last_row};
1323 }
1324  
1325 #-------------------------------------------------------
1326 # Subroutine: getTableRows
1327 # Author: Joerg Jaspert
1328 # Date: 4 Aug 2001
1329 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1330 # Modified: 12 Sept 2007 - Anthony Peacock
1331 #-------------------------------------------------------
1332 0 ▶sub getTableRows{
Subroutine getTableRows: not called CC=1 SCAR=6.9
Pod documented
1333 0 my $self = shift;
1334 0 return $self->getSectionTableRows ( 'tbody', 0 );
1335 }
1336  
1337 #-------------------------------------------------------
1338 # Subroutine: getTableCols
1339 # Author: Joerg Jaspert
1340 # Date: 4 Aug 2001
1341 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1342 #-------------------------------------------------------
1343 0 ▶sub getTableCols{
Subroutine getTableCols: not called CC=1 SCAR=6.9
Pod documented
1344 0 my $self = shift;
1345 0 return $self->{last_col};
1346 }
1347  
1348 #-------------------------------------------------------
1349 # Subroutine: getStyle
1350 # Author: Douglas Riordan
1351 # Date: 30 Nov 2005
1352 # Description: getter for table style
1353 #-------------------------------------------------------
1354  
1355 0 ▶sub getStyle {
Subroutine getStyle: not called CC=2 SCAR=17.9
Pod documented
1356 0 ▶ return shift->{style} || undef;
Condition0%0/2
+(shift())->{'style'} || undef
l!l
00
MC/DC0%0/1
+(shift())->{'style'} || undef
+(shift())->{'style'}
Truth table0%0/2
A
A= +(shift())->{'style'}
Aresult
11
00
1357 }
1358  
1359 #-------------------------------------------------------
1360 # Subroutine: sort (sort_col_num, [ALPHA|NUMERIC], [ASC|DESC],
1361 # num_rows_to_skip)
1362 # sort ( -section=>'section',
1363 # -section_num=>number,
1364 # -sort_col=>sort_col_num,
1365 # -sort_type=>[ALPHA|NUMERIC],
1366 # -sort_order=>[ASC|DESC],
1367 # -skip_rows=>num_rows_to_skip,
1368 # -strip_html=>[0|1], # default 1
1369 # -strip_non_numeric=>[0|1], # default 1
1370 # # for sort_type=NUMERIC
1371 # -presort_func=>\&filter,
1372 # )
1373 # Author: David Link
1374 # Date: 28 Jun 2002
1375 # Modified: 09 Apr 2003 -- dl Added options: -strip_html,
1376 # -strip_non_numeric, and -presort_func.
1377 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1378 # Modified: 12 Sept 2007 - Anthony Peacock
1379 #-------------------------------------------------------
1380 0 ▶sub sort {
Subroutine sort: not called CC=23 SCAR=63.1
Pod documented
1381 0 my $self = shift;
1382 0 my ($sort_col, $sort_type, $sort_order, $skip_rows,
1383 $strip_html, $strip_non_numeric, $presort_func, $section, $section_num);
1384 0 $strip_html = 1;
1385 0 $strip_non_numeric = 1;
1386
1387 # Set the default section to the first 'tbody'
1388 0 $section = 'tbody';
1389 0 $section_num = 0;
1390
1391 0 ▶ if (defined $_[0] && $_[0] =~ /^-/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0] and $_[0] =~ /^-/) { } 0 0 0
Condition0%0/3
defined $_[0] and $_[0] =~ /^-/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^-/
defined $_[0] $_[0] =~ /^-/
Truth table0%0/3
A and B
A= defined $_[0]B= $_[0] =~ /^-/
ABresult
0X0
100
111
1392 0 my %flag = @_;
1393 0 ▶ $section = $flag{-section} || 'tbody';
Condition0%0/2
$flag{'-section'} || 'tbody'
l!l
00
MC/DC0%0/1
$flag{'-section'} || 'tbody'
$flag{'-section'}
Truth table0%0/2
A
A= $flag{'-section'}
Aresult
11
00
1394 0 ▶ $section_num = $flag{-section_num} || 0;
Condition0%0/2
$flag{'-section_num'} || 0
l!l
00
MC/DC0%0/1
$flag{'-section_num'} || 0
$flag{'-section_num'}
Truth table0%0/2
A
A= $flag{'-section_num'}
Aresult
11
00
1395 0 ▶ $sort_col = $flag{-sort_col} || 1;
Condition0%0/2
$flag{'-sort_col'} || 1
l!l
00
MC/DC0%0/1
$flag{'-sort_col'} || 1
$flag{'-sort_col'}
Truth table0%0/2
A
A= $flag{'-sort_col'}
Aresult
11
00
1396 0 ▶ $sort_type = $flag{-sort_type} || "alpha";
Condition0%0/2
$flag{'-sort_type'} || 'alpha'
l!l
00
MC/DC0%0/1
$flag{'-sort_type'} || 'alpha'
$flag{'-sort_type'}
Truth table0%0/2
A
A= $flag{'-sort_type'}
Aresult
11
00
1397 0 ▶ $sort_order = $flag{-sort_order} || "asc";
Condition0%0/2
$flag{'-sort_order'} || 'asc'
l!l
00
MC/DC0%0/1
$flag{'-sort_order'} || 'asc'
$flag{'-sort_order'}
Truth table0%0/2
A
A= $flag{'-sort_order'}
Aresult
11
00
1398 0 ▶ $skip_rows = $flag{-skip_rows} || 0;
Condition0%0/2
$flag{'-skip_rows'} || 0
l!l
00
MC/DC0%0/1
$flag{'-skip_rows'} || 0
$flag{'-skip_rows'}
Truth table0%0/2
A
A= $flag{'-skip_rows'}
Aresult
11
00
1399 0 ▶ $strip_html = $flag{-strip_html} if defined($flag{-strip_html});
Branch: 1 branch
BranchTrueFalseTotal
if defined $flag{"-strip_html"} 0 0 0
1400 $strip_non_numeric = $flag{-strip_non_numeric}
1401 0 ▶ if defined($flag{-strip_non_numeric});
Branch: 1 branch
BranchTrueFalseTotal
if defined $flag{"-strip_non_numeric"} 0 0 0
1402 0 ▶ $presort_func = $flag{-presort_func} || undef;
Condition0%0/2
$flag{'-presort_func'} || undef
l!l
00
MC/DC0%0/1
$flag{'-presort_func'} || undef
$flag{'-presort_func'}
Truth table0%0/2
A
A= $flag{'-presort_func'}
Aresult
11
00
1403 }
1404 else {
1405 0 ▶ $sort_col = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1406 0 ▶ $sort_type = shift || "alpha";
Condition0%0/2
shift() || 'alpha'
l!l
00
MC/DC0%0/1
shift() || 'alpha'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1407 0 ▶ $sort_order = shift || "asc";
Condition0%0/2
shift() || 'asc'
l!l
00
MC/DC0%0/1
shift() || 'asc'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1408 0 ▶ $skip_rows = shift || 0;
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1409 0 $presort_func = undef;
1410 }
1411 0 ▶ my $cmp_symbol = lc($sort_type) eq "alpha" ? "cmp" : "<=>";
Branch: 1 branch
BranchTrueFalseTotal
lc $sort_type eq 'alpha' ? : 0 0 0
1412 0 ▶ my ($first, $last) = lc($sort_order) eq "asc"?("\$a", "\$b"):("\$b", "\$a");
Branch: 1 branch
BranchTrueFalseTotal
lc $sort_order eq 'asc' ? : 0 0 0
1413 0 my $piece1 = qq/\$self->{$section}[$section_num]->{rows}[$first]->{cells}[$sort_col]->{contents}/;
1414 0 my $piece2 = qq/\$self->{$section}[$section_num]->{rows}[$last]->{cells}[$sort_col]->{contents}/;
1415 0 ▶ if ($strip_html) {
Branch: 1 branch
BranchTrueFalseTotal
if ($strip_html) 0 0 0
1416 0 $piece1 = qq/&_stripHTML($piece1)/;
1417 0 $piece2 = qq/&_stripHTML($piece2)/;
1418 }
1419 0 ▶ if ($presort_func) {
Branch: 1 branch
BranchTrueFalseTotal
if ($presort_func) 0 0 0
1420 0 $piece1 = qq/\&{\$presort_func}($piece1)/;
1421 0 $piece2 = qq/\&{\$presort_func}($piece2)/;
1422 }
1423 0 ▶ if (lc($sort_type) ne 'alpha' && $strip_non_numeric) {
Branch: 1 branch
BranchTrueFalseTotal
if (lc $sort_type ne "alpha" and $strip_non_numeric) 0 0 0
Condition0%0/3
lc $sort_type ne "alpha" and $strip_non_numeric
!ll&&!rl&&r
000
MC/DC0%0/2
lc $sort_type ne "alpha" and $strip_non_numeric
lc $sort_type ne "alpha" $strip_non_numeric
Truth table0%0/3
A and B
A= lc $sort_type ne "alpha"B= $strip_non_numeric
ABresult
0X0
100
111
1424 0 $piece1 = qq/&_stripNonNumeric($piece1)/;
1425 0 $piece2 = qq/&_stripNonNumeric($piece2)/;
1426 }
1427 0 my $sortfunc = qq/sub { $piece1 $cmp_symbol $piece2 }/;
1428 0 my $sorter = eval($sortfunc);
1429 0 my @sortkeys = sort $sorter (($skip_rows+1)..$self->{$section}[$section_num]->{last_row});
1430  
1431 0 my @holdtable = @{$self->{$section}[$section_num]->{rows}};
1432 0 my $i = $skip_rows+1;
1433 0 for my $k (@sortkeys) {
1434 0 $self->{$section}[$section_num]->{rows}[$i++] = $holdtable[$k];
1435 }
1436 }
1437  
1438 #-------------------------------------------------------
1439 # Subroutine: _stripHTML (html_string)
1440 # Author: David Link
1441 # Date: 12 Feb 2003
1442 #-------------------------------------------------------
1443 0 ▶sub _stripHTML {
Subroutine _stripHTML: not called CC=1 SCAR=6.9
1444 0 $_ = $_[0];
1445 0 s/ \< [^>]* \> //gx;
1446 0 s/\&nbsp;/ /g;
1447 0 return $_;
1448 }
1449  
1450 #-------------------------------------------------------
1451 # Subroutine: _stripNonNumeric (string)
1452 # Author: David Link
1453 # Date: 04 Apr 2003
1454 # Description: Remove all non-numeric char from a string
1455 # For efficiency does not deal with:
1456 # 1. nested '-' chars., 2. multiple '.' chars.
1457 #-------------------------------------------------------
1458 0 ▶sub _stripNonNumeric {
Subroutine _stripNonNumeric: not called CC=2 SCAR=17.9
1459 0 $_ = $_[0];
1460 0 s/[^0-9.+-]//g;
1461 0 ▶ return 0 if !$_;
Branch: 1 branch
BranchTrueFalseTotal
unless $_ 0 0 0
1462 0 return $_;
1463 }
1464  
1465 #-------------------------------------------------------
1466 # Section config methods
1467 #
1468 #-------------------------------------------------------
1469  
1470 #-------------------------------------------------------
1471 # Subroutine: setSectionAlign('Section', section_num, [left|right|center])
1472 # Author: Anthony Peacock
1473 # Date: 10 Septmeber 2007
1474 #-------------------------------------------------------
1475 0 ▶sub setSectionAlign {
Subroutine setSectionAlign: not called CC=5 SCAR=34.0
Pod documented
1476 0 my $self = shift;
1477 0 my $section = lc(shift);
1478 0 my $section_num = shift;
1479  
1480 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1481 0 print STDERR "\nsetSectionAlign: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1482 0 return 0;
1483 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1484 0 print STDERR "\nsetSectionAlign: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1485 0 return 0;
1486 }
1487
1488 0 ▶ $self->{$section}[$section_num]->{align} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1489 }
1490  
1491 #-------------------------------------------------------
1492 # Subroutine: setSectionId('Section', section_num, 'Id')
1493 # Author: Anthony Peacock
1494 # Date: 10 Septmeber 2007
1495 #-------------------------------------------------------
1496 0 ▶sub setSectionId {
Subroutine setSectionId: not called CC=5 SCAR=34.0
Pod documented
1497 0 my $self = shift;
1498 0 my $section = lc(shift);
1499 0 my $section_num = shift;
1500  
1501 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1502 0 print STDERR "\nsetSectionId: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1503 0 return 0;
1504 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1505 0 print STDERR "\nsetSectionId: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1506 0 return 0;
1507 }
1508
1509 0 ▶ $self->{$section}[$section_num]->{id} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1510 }
1511  
1512 #-------------------------------------------------------
1513 # Subroutine: setSectionClass('Section', section_num, 'Class')
1514 # Author: Anthony Peacock
1515 # Date: 10 Septmeber 2007
1516 #-------------------------------------------------------
1517 0 ▶sub setSectionClass {
Subroutine setSectionClass: not called CC=5 SCAR=34.0
Pod documented
1518 0 my $self = shift;
1519 0 my $section = lc(shift);
1520 0 my $section_num = shift;
1521  
1522 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1523 0 print STDERR "\nsetSectionClass: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1524 0 return 0;
1525 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1526 0 print STDERR "\nsetSectionClass: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1527 0 return 0;
1528 }
1529
1530 0 ▶ $self->{$section}[$section_num]->{class} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1531 }
1532  
1533 #-------------------------------------------------------
1534 # Subroutine: setSectionStyle('Section', section_num, 'style')
1535 # Author: Anthony Peacock
1536 # Date: 10 Septmeber 2007
1537 #-------------------------------------------------------
1538 0 ▶sub setSectionStyle {
Subroutine setSectionStyle: not called CC=5 SCAR=34.0
Pod documented
1539 0 my $self = shift;
1540 0 my $section = lc(shift);
1541 0 my $section_num = shift;
1542  
1543 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1544 0 print STDERR "\nsetSectionStyle: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1545 0 return 0;
1546 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1547 0 print STDERR "\nsetSectionStyle: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1548 0 return 0;
1549 }
1550
1551 0 ▶ $self->{$section}[$section_num]->{style} = shift || undef;
Condition0%0/2
shift() || undef
l!l
00
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1552 }
1553  
1554 #-------------------------------------------------------
1555 # Subroutine: setSectionValign('Section', section_num, [center|top|bottom|middle|baseline])
1556 # Author: Anthony Peacock
1557 # Date: 10 Septmeber 2007
1558 #-------------------------------------------------------
1559 0 ▶sub setSectionValign {
Subroutine setSectionValign: not called CC=9 SCAR=45.0
Pod documented
1560 0 my $self = shift;
1561 0 my $section = lc(shift);
1562 0 my $section_num = shift;
1563 0 my $valign = lc(shift);
1564  
1565 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1566 0 print STDERR "\nsetSectionValign: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1567 0 return 0;
1568 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1569 0 print STDERR "\nsetSectionValign: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1570 0 return 0;
1571 }
1572
1573 0 ▶ if (! (($valign eq "center") || ($valign eq "top") ||
Branch: 1 branch
BranchTrueFalseTotal
unless ($valign eq "center" or $valign eq "top" or $valign eq "bottom" or $valign eq "middle" or $valign eq "baseline") 0 0 0
Condition0%0/12
$valign eq "center" or $valign eq "top" or $valign eq "bottom" or $valign eq "middle" or $valign eq "baseline"
l!l&&r!l&&!r
000
$valign eq "center" or $valign eq "top" or $valign eq "bottom" or $valign eq "middle"
l!l&&r!l&&!r
000
$valign eq "center" or $valign eq "top" or $valign eq "bottom"
l!l&&r!l&&!r
000
$valign eq "center" or $valign eq "top"
l!l&&r!l&&!r
000
MC/DC0%0/5
$valign eq "center" or $valign eq "top" or $valign eq "bottom" or $valign eq "middle" or $valign eq "baseline"
$valign eq "center" $valign eq "top" $valign eq "bottom" $valign eq "middle" $valign eq "baseline"
Truth table0%0/6
A or B or C or D or E
A= $valign eq "center"B= $valign eq "top"C= $valign eq "bottom"D= $valign eq "middle"E= $valign eq "baseline"
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
1574 ($valign eq "bottom") || ($valign eq "middle") ||
1575 ($valign eq "baseline")) ) {
1576 0 print STDERR "$0:setSectionVAlign:Invalid alignment type\n";
1577 0 return 0;
1578 }
1579
1580 0 $self->{$section}[$section_num]->{valign} = $valign;
1581 }
1582  
1583 #-------------------------------------------------------
1584 # Subroutine: setSectionAttr('Section', section_num, 'attr')
1585 # Author: Anthony Peacock
1586 # Date: 10 Septmeber 2007
1587 #-------------------------------------------------------
1588 0 ▶sub setSectionAttr {
Subroutine setSectionAttr: not called CC=4 SCAR=30.0
Pod documented
1589 0 my $self = shift;
1590 0 my $section = lc(shift);
1591 0 my $section_num = shift;
1592  
1593 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1594 0 print STDERR "\nsetSectionAttr: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1595 0 return 0;
1596 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1597 0 print STDERR "\nsetSectionAttr: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1598 0 return 0;
1599 }
1600
1601 0 $self->{$section}[$section_num]->{attr} = shift;
1602 }
1603  
1604 #-------------------------------------------------------
1605 # Cell config methods
1606 #
1607 #-------------------------------------------------------
1608  
1609 #-------------------------------------------------------
1610 # Subroutine: setSectionCell("section", section_num, row_num, col_num, "content")
1611 # Author: Anthony Peacock
1612 # Date: 10 September 2007
1613 #-------------------------------------------------------
1614 0 ▶sub setSectionCell {
Subroutine setSectionCell: not called CC=14 SCAR=53.5
Pod documented
1615 0 my $self = shift;
1616 0 my $section = lc(shift);
1617 0 my $section_num = shift;
1618 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1619 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1620
1621 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1622 0 print STDERR "\nsetSectionCell: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1623 0 return 0;
1624 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1625 0 print STDERR "\nsetSectionCell: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1626 0 return 0;
1627 }
1628  
1629 # If -1 is used in either the row or col parameter, use the last row or cell
1630 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
1631 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
1632  
1633 0 ▶ if ($row < 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row < 1) 0 0 0
1634 0 print STDERR "$0:setSectionCell:Invalid table row reference $row:$col\n";
1635 0 return 0;
1636 }
1637 0 ▶ if ($col < 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col < 1) 0 0 0
1638 0 print STDERR "$0:setSectionCell:Invalid table column reference $row:$col\n";
1639 0 return 0;
1640 }
1641 0 ▶ if ($row > $self->{$section}[$section_num]{last_row}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"}) 0 0 0
1642 0 ▶ if ($self->{autogrow}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'autogrow'}) { } 0 0 0
1643 0 $self->{$section}[$section_num]{last_row} = $row ;
1644 } else {
1645 0 print STDERR "$0:setSectionCell:Invalid table row reference $row:$col\n";
1646 }
1647 }
1648 0 ▶ if ($col > $self->{last_col}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"}) 0 0 0
1649 0 ▶ if ($self->{autogrow}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'autogrow'}) { } 0 0 0
1650 0 $self->{last_col} = $col ;
1651 } else {
1652 0 print STDERR "$0:setSectionCell:Invalid table column reference $row:$col\n";
1653 }
1654 }
1655 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{contents} = shift;
1656 0 return ($row, $col);
1657  
1658 }
1659  
1660 #-------------------------------------------------------
1661 # Subroutine: setCell(row_num, col_num, "content")
1662 # Author: Stacy Lacy
1663 # Date: 30 Jul 1997
1664 # Modified: 08 Feb 2001 - John Stumbles to allow auto-growing of table
1665 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1666 #-------------------------------------------------------
1667 0 ▶sub setCell {
Subroutine setCell: not called CC=3 SCAR=24.8
Pod documented
1668 0 my $self = shift;
1669 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1670 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1671 0 my $contents = shift;
1672  
1673 0 return $self->setSectionCell ( 'tbody', 0, $row, $col, $contents );
1674 }
1675  
1676 #-------------------------------------------------------
1677 # Subroutine: getSectionCell('section', section_num, row_num, col_num)
1678 # Author: Anthony Peacock
1679 # Date: 12 Sept 2007
1680 # Based on: getCell
1681 #-------------------------------------------------------
1682 0 ▶sub getSectionCell {
Subroutine getSectionCell: not called CC=12 SCAR=50.5
Pod documented
1683 0 my $self = shift;
1684 0 my $section = shift;
1685 0 my $section_num = shift;
1686 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1687 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1688
1689 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1690 0 print STDERR "\ngetSectionCell: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1691 0 return 0;
1692 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1693 0 print STDERR "\ngetSectionCell: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1694 0 return 0;
1695 }
1696  
1697 # If -1 is used in either the row or col parameter, use the last row or cell
1698 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
1699 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
1700  
1701 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
1702 0 print STDERR "$0:getSectionCell:Invalid table reference $row:$col\n";
1703 0 return 0;
1704 }
1705 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
1706 0 print STDERR "$0:getSectionCell:Invalid table reference $row:$col\n";
1707 0 return 0;
1708 }
1709  
1710 0 return $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{contents} ;
1711 }
1712  
1713 #-------------------------------------------------------
1714 # Subroutine: getCell(row_num, col_num)
1715 # Author: Anthony Peacock
1716 # Date: 27 Jul 1998
1717 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1718 # Modified: 12 Sept 2007 - Anthony Peacock
1719 #-------------------------------------------------------
1720 0 ▶sub getCell {
Subroutine getCell: not called CC=3 SCAR=24.8
Pod documented
1721 0 my $self = shift;
1722 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1723 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1724
1725 0 return $self->getSectionCell ( 'tbody', 0, $row, $col) ;
1726 }
1727  
1728 #-------------------------------------------------------
1729 # Subroutine: getSectionCellStyle('section', section_num, $row_num, $col_num)
1730 # Author: Anthony Peacock
1731 # Date: 12 Sept 2007
1732 # Description: getter for cell style
1733 # Based on: getCellStyle
1734 #-------------------------------------------------------
1735 0 ▶sub getSectionCellStyle {
Subroutine getSectionCellStyle: not called CC=5 SCAR=34.0
Pod documented
1736 0 my $self = shift;
1737 0 my $section = shift;
1738 0 my $section_num = shift;
1739 0 my ($row, $col) = @_;
1740
1741 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1742 0 print STDERR "\ngetSectionCellStyle: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1743 0 return 0;
1744 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1745 0 print STDERR "\ngetSectionCellStyle: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1746 0 return 0;
1747 }
1748  
1749 return $self->_checkRowAndCol('getSectionCellStyle', $section, $section_num, {row => $row, col => $col})
1750 ? $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{style}
1751 0 ▶ : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->_checkRowAndCol('getSectionCellStyle', $section, $section_num, {'row', $row, 'col', $col}) ? : 0 0 0
1752 }
1753  
1754 #-------------------------------------------------------
1755 # Subroutine: getCellStyle($row_num, $col_num)
1756 # Author: Douglas Riordan
1757 # Date: 30 Nov 2005
1758 # Description: getter for cell style
1759 # Modified: 12 Sept 2007 - Anthony Peacock
1760 #-------------------------------------------------------
1761 0 ▶sub getCellStyle {
Subroutine getCellStyle: not called CC=1 SCAR=6.9
Pod documented
1762 0 my ($self, $row, $col) = @_;
1763  
1764 0 return $self->getSectionCellStyle('tbody', 0, $row, $col);
1765 }
1766  
1767 #-------------------------------------------------------
1768 # Subroutine: setSectionCellAlign('section', section_num, row_num, col_num, [center|right|left])
1769 # Author: Anthony Peacock
1770 # Date: 12 Sept 2007
1771 # Based on: setCellAlign
1772 #-------------------------------------------------------
1773 0 ▶sub setSectionCellAlign {
Subroutine setSectionCellAlign: not called CC=16 SCAR=56.1
Pod documented
1774 0 my $self = shift;
1775 0 my $section = shift;
1776 0 my $section_num = shift;
1777 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1778 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1779 0 my $align = lc(shift);
1780
1781 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1782 0 print STDERR "\nsetSectionCellAlign: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1783 0 return 0;
1784 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1785 0 print STDERR "\nsetSectionCellAlign: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1786 0 return 0;
1787 }
1788  
1789 # If -1 is used in either the row or col parameter, use the last row or cell
1790 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
1791 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
1792  
1793 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
1794 0 print STDERR "$0:setSectionCellAlign:Invalid table reference\n";
1795 0 return 0;
1796 }
1797 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
1798 0 print STDERR "$0:setSectionCellAlign:Invalid table reference\n";
1799 0 return 0;
1800 }
1801  
1802 0 ▶ if (! $align) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($align) 0 0 0
1803 #return to default alignment if none specified
1804 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{align};
1805 0 return ($row, $col);
1806 }
1807  
1808 0 ▶ if (! (($align eq 'center') || ($align eq 'right') ||
Branch: 1 branch
BranchTrueFalseTotal
unless ($align eq "center" or $align eq "right" or $align eq "left") 0 0 0
Condition0%0/6
$align eq "center" or $align eq "right" or $align eq "left"
l!l&&r!l&&!r
000
$align eq "center" or $align eq "right"
l!l&&r!l&&!r
000
MC/DC0%0/3
$align eq "center" or $align eq "right" or $align eq "left"
$align eq "center" $align eq "right" $align eq "left"
Truth table0%0/4
A or B or C
A= $align eq "center"B= $align eq "right"C= $align eq "left"
ABCresult
1XX1
01X1
0011
0000
1809 ($align eq 'left'))) {
1810 0 print STDERR "$0:setCellAlign:Invalid alignment type\n";
1811 0 return 0;
1812 }
1813  
1814 # We have a valid alignment type so let's set it for the cell
1815 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{align} = $align;
1816 0 return ($row, $col);
1817 }
1818  
1819 #-------------------------------------------------------
1820 # Subroutine: setCellAlign(row_num, col_num, [center|right|left])
1821 # Author: Stacy Lacy
1822 # Date: 30 Jul 1997
1823 # Modified: 13 Feb 2001 - Anthony Peacock for case insensitive
1824 # alignment parameters
1825 # (suggested by John Stumbles)
1826 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1827 # Modified: 12 Sept 2007 - Anthony Peacock
1828 #-------------------------------------------------------
1829 0 ▶sub setCellAlign {
Subroutine setCellAlign: not called CC=3 SCAR=24.8
Pod documented
1830 0 my $self = shift;
1831 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1832 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1833 0 my $align = lc(shift);
1834  
1835 0 return $self->setSectionCellAlign ( 'tbody', 0, $row, $col, $align );
1836 }
1837  
1838 #-------------------------------------------------------
1839 # Subroutine: setSectionCellVAlign('section', section_num, row_num, col_num, [center|top|bottom|middle|baseline])
1840 # Author: Anthony Peacock
1841 # Date: 12 Sept 2007
1842 # Based on: setCellVAlign
1843 #-------------------------------------------------------
1844 0 ▶sub setSectionCellVAlign {
Subroutine setSectionCellVAlign: not called CC=18 SCAR=58.3
Pod documented
1845 0 my $self = shift;
1846 0 my $section = shift;
1847 0 my $section_num = shift;
1848 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1849 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1850 0 my $valign = lc(shift);
1851
1852 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1853 0 print STDERR "\nsetSectionCellVAlign: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1854 0 return 0;
1855 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1856 0 print STDERR "\nsetSectionCellVAlign: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1857 0 return 0;
1858 }
1859
1860 # If -1 is used in either the row or col parameter, use the last row or cell
1861 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
1862 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
1863  
1864 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
1865 0 print STDERR "$0:setSectionCellVAlign:Invalid table reference\n";
1866 0 return 0;
1867 }
1868 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
1869 0 print STDERR "$0:setSectionCellVAlign:Invalid table reference\n";
1870 0 return 0;
1871 }
1872  
1873 0 ▶ if (! $valign) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($valign) 0 0 0
1874 #return to default alignment if none specified
1875 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{valign};
1876 0 return ($row, $col);
1877 }
1878  
1879 0 ▶ if (! (($valign eq "center") || ($valign eq "top") ||
Branch: 1 branch
BranchTrueFalseTotal
unless ($valign eq "center" or $valign eq "top" or $valign eq "bottom" or $valign eq "middle" or $valign eq "baseline") 0 0 0
Condition0%0/12
$valign eq "center" or $valign eq "top" or $valign eq "bottom" or $valign eq "middle" or $valign eq "baseline"
l!l&&r!l&&!r
000
$valign eq "center" or $valign eq "top" or $valign eq "bottom" or $valign eq "middle"
l!l&&r!l&&!r
000
$valign eq "center" or $valign eq "top" or $valign eq "bottom"
l!l&&r!l&&!r
000
$valign eq "center" or $valign eq "top"
l!l&&r!l&&!r
000
MC/DC0%0/5
$valign eq "center" or $valign eq "top" or $valign eq "bottom" or $valign eq "middle" or $valign eq "baseline"
$valign eq "center" $valign eq "top" $valign eq "bottom" $valign eq "middle" $valign eq "baseline"
Truth table0%0/6
A or B or C or D or E
A= $valign eq "center"B= $valign eq "top"C= $valign eq "bottom"D= $valign eq "middle"E= $valign eq "baseline"
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
1880 ($valign eq "bottom") || ($valign eq "middle") ||
1881 ($valign eq "baseline")) ) {
1882 0 print STDERR "$0:setSectionCellVAlign:Invalid alignment type\n";
1883 0 return 0;
1884 }
1885  
1886 # We have a valid valignment type so let's set it for the cell
1887 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{valign} = $valign;
1888 0 return ($row, $col);
1889 }
1890  
1891 #-------------------------------------------------------
1892 # Subroutine: setCellVAlign(row_num, col_num, [center|top|bottom|middle|baseline])
1893 # Author: Stacy Lacy
1894 # Date: 30 Jul 1997
1895 # Modified: 13 Feb 2001 - Anthony Peacock for case insensitive
1896 # alignment parameters
1897 # (suggested by John Stumbles)
1898 # Modified: 22 Aug 2003 - Alejandro Juarez to add MIDDLE and BASELINE
1899 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1900 # Modified: 12 Sept 2007
1901 #-------------------------------------------------------
1902 0 ▶sub setCellVAlign {
Subroutine setCellVAlign: not called CC=3 SCAR=24.8
Pod documented
1903 0 my $self = shift;
1904 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1905 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1906 0 my $valign = lc(shift);
1907
1908 0 return $self->setSectionCellVAlign ( 'tbody', 0, $row, $col, $valign );
1909 }
1910  
1911 #-------------------------------------------------------
1912 # Subroutine: setSectionCellHead('section', section_num, row_num, col_num, [0|1])
1913 # Author: Anthony Peacock
1914 # Date: 12 Sept 2007
1915 # Based on: setCellHead
1916 #-------------------------------------------------------
1917 0 ▶sub setSectionCellHead {
Subroutine setSectionCellHead: not called CC=13 SCAR=52.0
Pod documented
1918 0 my $self = shift;
1919 0 my $section = shift;
1920 0 my $section_num = shift;
1921 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1922 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1923 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1924
1925 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1926 0 print STDERR "\nsetSectionCellHead: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1927 0 return 0;
1928 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1929 0 print STDERR "\nsetSectionCellHead: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1930 0 return 0;
1931 }
1932  
1933 # If -1 is used in either the row or col parameter, use the last row or cell
1934 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
1935 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
1936  
1937 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
1938 0 print STDERR "$0:setSectionCellHead:Invalid table reference\n";
1939 0 return 0;
1940 }
1941 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
1942 0 print STDERR "$0:setSectionCellHead:Invalid table reference\n";
1943 0 return 0;
1944 }
1945  
1946 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{head} = $value;
1947 0 return ($row, $col);
1948 }
1949  
1950 #-------------------------------------------------------
1951 # Subroutine: setCellHead(row_num, col_num, [0|1])
1952 # Author: Jay Flaherty
1953 # Date: 19 Mar 1998
1954 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
1955 # Modified: 12 Sept 2007 - Anthony Peacock
1956 #-------------------------------------------------------
1957 0 ▶sub setCellHead{
Subroutine setCellHead: not called CC=4 SCAR=30.0
Pod documented
1958 0 my $self = shift;
1959 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1960 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1961 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
1962  
1963 0 $self->setSectionCellHead ( 'tbody', 0, $row, $col, $value );
1964 }
1965  
1966 #-------------------------------------------------------
1967 # Subroutine: setSectionCellNoWrap('section', section_num, row_num, col_num, [0|1])
1968 # Author: Anthony Peacock
1969 # Date: 12 Sept 2007
1970 # Based on: setCellNoWrap
1971 #-------------------------------------------------------
1972 0 ▶sub setSectionCellNoWrap {
Subroutine setSectionCellNoWrap: not called CC=12 SCAR=50.5
Pod documented
1973 0 my $self = shift;
1974 0 my $section = shift;
1975 0 my $section_num = shift;
1976 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
1977 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
1978 0 (my $value = shift);
1979
1980 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
1981 0 print STDERR "\nsetSectionCellNoWrap: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
1982 0 return 0;
1983 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
1984 0 print STDERR "\nsetSectionCellNoWrap: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
1985 0 return 0;
1986 }
1987  
1988 # If -1 is used in either the row or col parameter, use the last row or cell
1989 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
1990 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
1991  
1992 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
1993 0 print STDERR "$0:setSectionCellNoWrap:Invalid table reference\n";
1994 0 return 0;
1995 }
1996 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
1997 0 print STDERR "$0:setSectionCellNoWrap:Invalid table reference\n";
1998 0 return 0;
1999 }
2000  
2001 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{nowrap} = $value;
2002 0 return ($row, $col);
2003 }
2004  
2005 #-------------------------------------------------------
2006 # Subroutine: setCellNoWrap(row_num, col_num, [0|1])
2007 # Author: Stacy Lacy
2008 # Date: 30 Jul 1997
2009 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2010 # Modified: 12 Sept 2007 - Anthony Peacock
2011 #-------------------------------------------------------
2012 0 ▶sub setCellNoWrap {
Subroutine setCellNoWrap: not called CC=3 SCAR=24.8
Pod documented
2013 0 my $self = shift;
2014 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2015 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2016 0 (my $value = shift);
2017  
2018 0 $self->setSectionCellNoWrap ( 'tbody', 0, $row, $col, $value );
2019 }
2020  
2021 #-------------------------------------------------------
2022 # Subroutine: setSectionCellWidth('section', section_num, row_num, col_num, [pixels|percentoftable])
2023 # Author: Anthony Peacock
2024 # Date: 12 Sept 2007
2025 # Based on: setCellWidth
2026 #-------------------------------------------------------
2027 0 ▶sub setSectionCellWidth {
Subroutine setSectionCellWidth: not called CC=14 SCAR=53.5
Pod documented
2028 0 my $self = shift;
2029 0 my $section = shift;
2030 0 my $section_num = shift;
2031 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2032 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2033 0 (my $value = shift);
2034
2035 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2036 0 print STDERR "\nsetSectionCellWidth: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2037 0 return 0;
2038 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2039 0 print STDERR "\nsetSectionCellWidth: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2040 0 return 0;
2041 }
2042  
2043 # If -1 is used in either the row or col parameter, use the last row or cell
2044 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2045 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
2046  
2047 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2048 0 print STDERR "$0:setSectionCellWidth:Invalid table reference\n";
2049 0 return 0;
2050 }
2051 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
2052 0 print STDERR "$0:setSectionCellWidth:Invalid table reference\n";
2053 0 return 0;
2054 }
2055  
2056 0 ▶ if (! $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
2057 #return to default alignment if none specified
2058 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{width};
2059 0 return ($row, $col);
2060 }
2061  
2062 0 ▶ if ( $value !~ /^\s*\d+%?/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value =~ /^\s*\d+%?/) { } 0 0 0
2063 0 print STDERR "$0:setSectionCellWidth:Invalid value $value\n";
2064 0 return 0;
2065 } else {
2066 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{width} = $value;
2067 0 return ($row, $col);
2068 }
2069 }
2070  
2071 #-------------------------------------------------------
2072 # Subroutine: setCellWidth(row_num, col_num, [pixels|percentoftable])
2073 # Author: Stacy Lacy
2074 # Date: 30 Jul 1997
2075 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2076 # Modified: 12 Sept 2007
2077 #-------------------------------------------------------
2078 0 ▶sub setCellWidth {
Subroutine setCellWidth: not called CC=3 SCAR=24.8
Pod documented
2079 0 my $self = shift;
2080 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2081 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2082 0 (my $value = shift);
2083  
2084 0 $self->setSectionCellWidth ( 'tbody', 0, $row, $col, $value );
2085 }
2086  
2087 #-------------------------------------------------------
2088 # Subroutine: setSectionCellHeight('section', section_num, row_num, col_num, [pixels])
2089 # Author: Anthony Peacock
2090 # Date: 12 Sept 2007
2091 # Based on: setCellHeight
2092 #-------------------------------------------------------
2093 0 ▶sub setSectionCellHeight {
Subroutine setSectionCellHeight: not called CC=13 SCAR=52.0
Pod documented
2094 0 my $self = shift;
2095 0 my $section = shift;
2096 0 my $section_num = shift;
2097 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2098 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2099 0 (my $value = shift);
2100
2101 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2102 0 print STDERR "\nsetSectionCellHeight: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2103 0 return 0;
2104 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2105 0 print STDERR "\nsetSectionCellHeight: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2106 0 return 0;
2107 }
2108  
2109 # If -1 is used in either the row or col parameter, use the last row or cell
2110 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2111 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
2112  
2113 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2114 0 print STDERR "$0:setSectionCellHeight:Invalid table reference\n";
2115 0 return 0;
2116 }
2117 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
2118 0 print STDERR "$0:setSectionCellHeight:Invalid table reference\n";
2119 0 return 0;
2120 }
2121  
2122 0 ▶ if (! $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
2123 #return to default alignment if none specified
2124 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{height};
2125 0 return ($row, $col);
2126 }
2127  
2128 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{height} = $value;
2129 0 return ($row, $col);
2130 }
2131  
2132 #-------------------------------------------------------
2133 # Subroutine: setCellHeight(row_num, col_num, [pixels])
2134 # Author: Stacy Lacy
2135 # Date: 30 Jul 1997
2136 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2137 # Modified: 12 Sept 2007
2138 #-------------------------------------------------------
2139 0 ▶sub setCellHeight {
Subroutine setCellHeight: not called CC=3 SCAR=24.8
Pod documented
2140 0 my $self = shift;
2141 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2142 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2143 0 (my $value = shift);
2144  
2145 0 $self->setSectionCellHeight ( 'tbody', 0, $row, $col, $value );
2146 0 return ($row, $col);
2147 }
2148  
2149 #-------------------------------------------------------
2150 # Subroutine: setSectionCellBGColor('section', section_num, row_num, col_num, [colorname|colortrip])
2151 # Author: Anthony Peacock
2152 # Date: 12 Sept 2007
2153 # Based on: setCellBGColor
2154 #-------------------------------------------------------
2155 0 ▶sub setSectionCellBGColor {
Subroutine setSectionCellBGColor: not called CC=13 SCAR=52.0
Pod documented
2156 0 my $self = shift;
2157 0 my $section = shift;
2158 0 my $section_num = shift;
2159 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2160 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2161 0 (my $value = shift);
2162
2163 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2164 0 print STDERR "\nsetSectionCellBGColor: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2165 0 return 0;
2166 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2167 0 print STDERR "\nsetSectionCellBGColor: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2168 0 return 0;
2169 }
2170  
2171 # If -1 is used in either the row or col parameter, use the last row or cell
2172 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2173 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
2174  
2175 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2176 0 print STDERR "$0:setSectionCellBGColor:Invalid table reference\n";
2177 0 return 0;
2178 }
2179 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
2180 0 print STDERR "$0:setSectionCellBGColor:Invalid table reference\n";
2181 0 return 0;
2182 }
2183  
2184 0 ▶ if (! $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
2185 #return to default alignment if none specified
2186 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{bgcolor};
2187 }
2188  
2189 # BG colors are too hard to verify, let's assume user
2190 # knows what they are doing
2191 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{bgcolor} = $value;
2192 0 return ($row, $col);
2193 }
2194  
2195 #-------------------------------------------------------
2196 # Subroutine: setCellBGColor(row_num, col_num, [colorname|colortrip])
2197 # Author: Stacy Lacy
2198 # Date: 30 Jul 1997
2199 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2200 # Modified: 12 Sept 2007 - Anthony Peacock
2201 #-------------------------------------------------------
2202 0 ▶sub setCellBGColor {
Subroutine setCellBGColor: not called CC=3 SCAR=24.8
Pod documented
2203 0 my $self = shift;
2204 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2205 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2206 0 (my $value = shift);
2207  
2208 0 $self->setSectionCellBGColor ( 'tbody', 0, $row, $col, $value );
2209 }
2210  
2211 #-------------------------------------------------------
2212 # Subroutine: setSectionCellSpan('section', section_num, row_num, col_num, num_rows, num_cols)
2213 # Author: Anthony Peacock
2214 # Date: 12 Sept 2007
2215 # Based on: setCellSpan
2216 #-------------------------------------------------------
2217 0 ▶sub setSectionCellSpan {
Subroutine setSectionCellSpan: not called CC=14 SCAR=53.5
Pod documented
2218 0 my $self = shift;
2219 0 my $section = shift;
2220 0 my $section_num = shift;
2221 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2222 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2223 0 (my $num_rows = shift);
2224 0 (my $num_cols = shift);
2225
2226 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2227 0 print STDERR "\nsetSectionCellSpan: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2228 0 return 0;
2229 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2230 0 print STDERR "\nsetSectionCellSpan: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2231 0 return 0;
2232 }
2233  
2234 # If -1 is used in either the row or col parameter, use the last row or cell
2235 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2236 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
2237  
2238 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2239 0 print STDERR "$0:setSectionCellSpan:Invalid table reference\n";
2240 0 return 0;
2241 }
2242 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
2243 0 print STDERR "$0:setSectionCellSpan:Invalid table reference\n";
2244 0 return 0;
2245 }
2246  
2247 0 ▶ if (! $num_cols || ! $num_rows) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($num_cols and $num_rows) 0 0 0
Condition0%0/3
$num_cols and $num_rows
!ll&&!rl&&r
000
MC/DC0%0/2
$num_cols and $num_rows
$num_cols $num_rows
Truth table0%0/3
A and B
A= $num_colsB= $num_rows
ABresult
0X0
100
111
2248 #return to default if none specified
2249 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{colspan};
2250 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{rowspan};
2251 }
2252  
2253 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{colspan} = $num_cols;
2254 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{rowspan} = $num_rows;
2255  
2256 0 $self->_updateSpanGrid($section, $section_num, $row,$col);
2257
2258 0 return ($row, $col);
2259 }
2260  
2261 #-------------------------------------------------------
2262 # Subroutine: setCellSpan(row_num, col_num, num_rows, num_cols)
2263 # Author: Anthony Peacock
2264 # Date: 22 July 2002
2265 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2266 # Modified: 12 Sept 2007 - Anthony Peacock
2267 #-------------------------------------------------------
2268 0 ▶sub setCellSpan {
Subroutine setCellSpan: not called CC=3 SCAR=24.8
Pod documented
2269 0 my $self = shift;
2270 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2271 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2272 0 (my $num_rows = shift);
2273 0 (my $num_cols = shift);
2274  
2275 0 return $self->setSectionCellSpan ('tbody', 0, $row, $col, $num_rows, $num_cols);
2276 }
2277  
2278 #-------------------------------------------------------
2279 # Subroutine: setSectionCellRowSpan('section', section_num, row_num, col_num, num_cells)
2280 # Author: Anthony Peacock
2281 # Date: 10 September 2007
2282 # Based on: setCellRowSpan
2283 #-------------------------------------------------------
2284 0 ▶sub setSectionCellRowSpan {
Subroutine setSectionCellRowSpan: not called CC=13 SCAR=52.0
Pod documented
2285 0 my $self = shift;
2286 0 my $section = lc(shift);
2287 0 my $section_num = shift;
2288 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2289 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2290 0 (my $value = shift);
2291
2292 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2293 0 print STDERR "\nsetSectionCellRowSpan: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2294 0 return 0;
2295 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2296 0 print STDERR "\nsetSectionCellRowSpan: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2297 0 return 0;
2298 }
2299  
2300 # If -1 is used in either the row or col parameter, use the last row or cell
2301 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2302 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
2303  
2304 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2305 0 print STDERR "$0:setSectionCellRowSpan:Invalid table reference\n";
2306 0 return 0;
2307 }
2308 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
2309 0 print STDERR "$0:setSectionCellRowSpan:Invalid table reference\n";
2310 0 return 0;
2311 }
2312  
2313 0 ▶ if (! $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
2314 #return to default alignment if none specified
2315 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{rowspan};
2316 }
2317  
2318 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{rowspan} = $value;
2319
2320 0 $self->_updateSpanGrid($section, $section_num, $row,$col);
2321
2322 0 return ($row, $col);
2323 }
2324  
2325 #-------------------------------------------------------
2326 # Subroutine: setCellRowSpan(row_num, col_num, num_cells)
2327 # Author: Stacy Lacy
2328 # Date: 31 Jul 1997
2329 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2330 # Modified: 10 Sept 2007 - Anthony Peacock
2331 #-------------------------------------------------------
2332 0 ▶sub setCellRowSpan {
Subroutine setCellRowSpan: not called CC=3 SCAR=24.8
Pod documented
2333 0 my $self = shift;
2334 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2335 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2336 0 (my $value = shift);
2337  
2338 0 return $self->setSectionCellRowSpan( 'tbody', 0, $row, $col, $value);
2339 }
2340  
2341 #-------------------------------------------------------
2342 # Subroutine: setSectionCellColSpan(row_num, col_num, num_cells)
2343 # Author: Anthony Peacock
2344 # Date: 12 Sept 2007
2345 # Based on: setCellColSpan
2346 #-------------------------------------------------------
2347 0 ▶sub setSectionCellColSpan {
Subroutine setSectionCellColSpan: not called CC=13 SCAR=52.0
Pod documented
2348 0 my $self = shift;
2349 0 my $section = shift;
2350 0 my $section_num = shift;
2351 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2352 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2353 0 (my $value = shift);
2354
2355 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2356 0 print STDERR "\nsetSectionCellColSpan: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2357 0 return 0;
2358 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2359 0 print STDERR "\nsetSectionCellColSpan: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2360 0 return 0;
2361 }
2362
2363 # If -1 is used in either the row or col parameter, use the last row or cell
2364 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2365 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
2366  
2367 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2368 0 print STDERR "$0:setSectionCellColSpan:Invalid table reference\n";
2369 0 return 0;
2370 }
2371  
2372 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
2373 0 print STDERR "$0:setSectionCellColSpan:Invalid table reference\n";
2374 0 return 0;
2375 }
2376  
2377 0 ▶ if (! $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
2378 #return to default alignment if none specified
2379 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{colspan};
2380 }
2381  
2382 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{colspan} = $value;
2383  
2384 0 $self->_updateSpanGrid($section, $section_num, $row,$col);
2385
2386 0 return ($row, $col);
2387 }
2388  
2389 #-------------------------------------------------------
2390 # Subroutine: setCellColSpan(row_num, col_num, num_cells)
2391 # Author: Stacy Lacy
2392 # Date: 31 Jul 1997
2393 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2394 #-------------------------------------------------------
2395 0 ▶sub setCellColSpan {
Subroutine setCellColSpan: not called CC=3 SCAR=24.8
Pod documented
2396 0 my $self = shift;
2397 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2398 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2399 0 (my $value = shift);
2400  
2401 0 return $self->setSectionCellColSpan ( 'tbody', 0, $row, $col, $value );
2402 }
2403  
2404 #-------------------------------------------------------
2405 # Subroutine: setSectionCellFormat('section', section_num, row_num, col_num, start_string, end_string)
2406 # Author: Anthony Peacock
2407 # Date: 12 Sept 2007
2408 # Description: Sets start and end HTML formatting strings for
2409 # the cell content
2410 # Based on: setCellFormat
2411 #-------------------------------------------------------
2412 0 ▶sub setSectionCellFormat {
Subroutine setSectionCellFormat: not called CC=13 SCAR=52.0
Pod documented
2413 0 my $self = shift;
2414 0 my $section = shift;
2415 0 my $section_num = shift;
2416 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2417 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2418 0 (my $start_string = shift);
2419 0 (my $end_string = shift);
2420
2421 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2422 0 print STDERR "\nsetSectionCellFormat: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2423 0 return 0;
2424 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2425 0 print STDERR "\nsetSectionCellFormat: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2426 0 return 0;
2427 }
2428  
2429 # If -1 is used in either the row or col parameter, use the last row or cell
2430 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2431 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
2432  
2433 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2434 0 print STDERR "$0:setSectionCellFormat:Invalid table reference\n";
2435 0 return 0;
2436 }
2437 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
2438 0 print STDERR "$0:setSectionCellFormat:Invalid table reference\n";
2439 0 return 0;
2440 }
2441  
2442 0 ▶ if (! $start_string) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $start_string) { } 0 0 0
2443 #return to default format if none specified
2444 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{startformat};
2445 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{endformat};
2446 }
2447 else
2448 {
2449 # No checks will be made on the validity of these strings
2450 # User must take responsibility for results...
2451 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{startformat} = $start_string;
2452 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{endformat} = $end_string;
2453 }
2454 0 return ($row, $col);
2455 }
2456  
2457 #-------------------------------------------------------
2458 # Subroutine: setCellFormat(row_num, col_num, start_string, end_string)
2459 # Author: Anthony Peacock
2460 # Date: 21 Feb 2001
2461 # Description: Sets start and end HTML formatting strings for
2462 # the cell content
2463 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2464 # Modified: 12 Sept 2007 - Anthony Peacock
2465 #-------------------------------------------------------
2466 0 ▶sub setCellFormat {
Subroutine setCellFormat: not called CC=3 SCAR=24.8
Pod documented
2467 0 my $self = shift;
2468 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2469 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2470 0 (my $start_string = shift);
2471 0 (my $end_string = shift);
2472  
2473 0 return $self->setSectionCellFormat ( 'tbody', 0, $row, $col, $start_string, $end_string );
2474 }
2475  
2476 #-------------------------------------------------------
2477 # Subroutine: setSectionCellStyle('section', section_num, row_num, col_num, "Style")
2478 # Author: Anthony Peacock
2479 # Date: 12 Sept 2007
2480 # Based on: setCellStyle
2481 #-------------------------------------------------------
2482 0 ▶sub setSectionCellStyle {
Subroutine setSectionCellStyle: not called CC=13 SCAR=52.0
Pod documented
2483 0 my $self = shift;
2484 0 my $section = shift;
2485 0 my $section_num = shift;
2486 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2487 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2488 0 (my $value = shift);
2489
2490 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2491 0 print STDERR "\nsetSectionCellStyle: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2492 0 return 0;
2493 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2494 0 print STDERR "\nsetSectionCellStyle: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2495 0 return 0;
2496 }
2497  
2498 # If -1 is used in either the row or col parameter, use the last row or cell
2499 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2500 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
2501  
2502 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2503 0 print STDERR "$0:setSectionCellStyle:Invalid table reference\n";
2504 0 return 0;
2505 }
2506 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
2507 0 print STDERR "$0:setSectionCellStyle:Invalid table reference\n";
2508 0 return 0;
2509 }
2510  
2511 0 ▶ if (! $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
2512 #return to default style if none specified
2513 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{style};
2514 0 return ($row, $col);
2515 }
2516  
2517 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{style} = $value;
2518 0 return ($row, $col);
2519 }
2520  
2521 #-------------------------------------------------------
2522 # Subroutine: setCellStyle(row_num, col_num, "Style")
2523 # Author: Anthony Peacock
2524 # Date: 10 Jan 2002
2525 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2526 # Modified: 12 Sept 2007 - Anthony Peacock
2527 #-------------------------------------------------------
2528 0 ▶sub setCellStyle {
Subroutine setCellStyle: not called CC=3 SCAR=24.8
Pod documented
2529 0 my $self = shift;
2530 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2531 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2532 0 (my $value = shift);
2533  
2534 0 return $self->setSectionCellStyle ( 'tbody', 0, $row, $col, $value );
2535 }
2536  
2537 #-------------------------------------------------------
2538 # Subroutine: setSectionCellClass('section', section_num, row_num, col_num, "class")
2539 # Author: Anthony Peacock
2540 # Date: 12 Sept 2007
2541 # Based on: setCellClass
2542 #-------------------------------------------------------
2543 0 ▶sub setSectionCellClass {
Subroutine setSectionCellClass: not called CC=13 SCAR=52.0
Pod documented
2544 0 my $self = shift;
2545 0 my $section = shift;
2546 0 my $section_num = shift;
2547 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2548 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2549 0 (my $value = shift);
2550  
2551 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2552 0 print STDERR "\nsetSectionCellClass: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2553 0 return 0;
2554 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2555 0 print STDERR "\nsetSectionCellClass: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2556 0 return 0;
2557 }
2558
2559 # If -1 is used in either the row or col parameter, use the last row or cell
2560 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2561 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
2562  
2563 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2564 0 print STDERR "$0:setSectionCellClass:Invalid table reference\n";
2565 0 return 0;
2566 }
2567 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
2568 0 print STDERR "$0:setSectionCellClass:Invalid table reference\n";
2569 0 return 0;
2570 }
2571  
2572 0 ▶ if (! $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
2573 #return to default class if none specified
2574 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{class};
2575 0 return ($row, $col);
2576 }
2577  
2578 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{class} = $value;
2579 0 return ($row, $col);
2580 }
2581  
2582 #-------------------------------------------------------
2583 # Subroutine: setCellClass(row_num, col_num, "class")
2584 # Author: Anthony Peacock
2585 # Date: 22 July 2002
2586 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2587 #-------------------------------------------------------
2588 0 ▶sub setCellClass {
Subroutine setCellClass: not called CC=3 SCAR=24.8
Pod documented
2589 0 my $self = shift;
2590 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2591 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2592 0 (my $value = shift);
2593  
2594 0 $self->setSectionCellClass ( 'tbody', 0, $row, $col, $value );
2595 }
2596  
2597 #-------------------------------------------------------
2598 # Subroutine: setSectionCellAttr('section', section_num, row_num, col_num, "cell attribute string")
2599 # Author: Anthony Peacock
2600 # Date: 12 Sept 2007
2601 # Based on: setCellAttr
2602 #-------------------------------------------------------
2603 0 ▶sub setSectionCellAttr {
Subroutine setSectionCellAttr: not called CC=13 SCAR=52.0
Pod documented
2604 0 my $self = shift;
2605 0 my $section = shift;
2606 0 my $section_num = shift;
2607 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2608 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2609 0 (my $value = shift);
2610
2611 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2612 0 print STDERR "\nsetSectionCellAttr: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2613 0 return 0;
2614 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2615 0 print STDERR "\nsetSectionCellAttr: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2616 0 return 0;
2617 }
2618  
2619 # If -1 is used in either the row or col parameter, use the last row or cell
2620 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2621 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
2622  
2623 0 ▶ if (($row > $self->{$section}[$section_num]->{last_row}) || ($row < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2624 0 print STDERR "$0:setSectionCellAttr:Invalid table reference\n";
2625 0 return 0;
2626 }
2627 0 ▶ if (($col > $self->{last_col}) || ($col < 1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
2628 0 print STDERR "$0:setSectionCellAttr:Invalid table reference\n";
2629 0 return 0;
2630 }
2631  
2632 0 ▶ if (! $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
2633 0 undef $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{attr};
2634 }
2635  
2636 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{attr} = $value;
2637 0 return ($row, $col);
2638 }
2639  
2640 #-------------------------------------------------------
2641 # Subroutine: setCellAttr(row_num, col_num, "cell attribute string")
2642 # Author: Anthony Peacock
2643 # Date: 10 Jan 2002
2644 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2645 # Modified: 12 Sept 2007 - Anthony Peacock
2646 #-------------------------------------------------------
2647 0 ▶sub setCellAttr {
Subroutine setCellAttr: not called CC=3 SCAR=24.8
Pod documented
2648 0 my $self = shift;
2649 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2650 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
2651 0 (my $value = shift);
2652  
2653 0 return $self->setSectionCellAttr ( 'tbody', 0, $row, $col, $value );
2654 }
2655  
2656 #-------------------------------------------------------
2657 # Row config methods
2658 #
2659 #-------------------------------------------------------
2660  
2661  
2662 #-------------------------------------------------------
2663 # Subroutine: addSectionRow("Section", section_num, "cell 1 content" [, "cell 2 content", ...])
2664 # Author: Anthony Peacock
2665 # Date: 10 August 2007
2666 # Modified:
2667 #-------------------------------------------------------
2668 0 ▶sub addSectionRow {
Subroutine addSectionRow: not called CC=6 SCAR=37.4
Pod documented
2669 0 my $self = shift;
2670 0 my $section = lc(shift);
2671 0 my $section_num = shift;
2672
2673 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2674 0 print STDERR "\naddSectionRow: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2675 0 return 0;
2676 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2677 0 print STDERR "\naddSectionRow: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2678 0 return 0;
2679 }
2680  
2681 # this sub should add a row, using @_ as contents
2682 0 my $count = @_;
2683 # if number of cells is greater than cols, let's assume
2684 # we want to add a column.
2685 0 ▶ $self->{last_col} = $count if ($count > $self->{last_col});
Branch: 1 branch
BranchTrueFalseTotal
if $count > $self->{"last_col"} 0 0 0
2686
2687 0 $self->{$section}[$section_num]->{last_row}++; # increment number of rows
2688 0 ▶ for (my $i = 1; $i <= $count; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $count) 0 0 0
2689 # Store each value in cell on row
2690 0 $self->{$section}[$section_num]->{rows}[$self->{$section}[$section_num]{last_row}]->{cells}[$i]->{contents} = shift;
2691 }
2692 0 return $self->{$section}[$section_num]{last_row};
2693
2694 }
2695  
2696 #-------------------------------------------------------
2697 # Subroutine: addRow("cell 1 content" [, "cell 2 content", ...])
2698 # Author: Stacy Lacy
2699 # Date: 30 Jul 1997
2700 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2701 #-------------------------------------------------------
2702 0 ▶sub addRow {
Subroutine addRow: not called CC=1 SCAR=6.9
Pod documented
2703 0 my $self = shift;
2704  
2705 0 my $last_row = $self->addSectionRow ( 'tbody', 0, @_ );
2706 0 return $last_row;
2707 }
2708  
2709 #-------------------------------------------------------
2710 # Subroutine: delSectionRow("Section", section_num, row_num)
2711 # Author: Anthony Peacock
2712 # Date: 10 April 2008
2713 # Modified:
2714 #-------------------------------------------------------
2715 0 ▶sub delSectionRow {
Subroutine delSectionRow: not called CC=5 SCAR=34.0
Pod documented
2716 0 my $self = shift;
2717 0 my $section = lc(shift);
2718 0 my $section_num = shift;
2719 0 my $row_num = shift;
2720
2721 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2722 0 print STDERR "\ndelSectionRow: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2723 0 return 0;
2724 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2725 0 print STDERR "\ndelSectionRow: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2726 0 return 0;
2727 }
2728
2729 # If -1 is used in the row parameter, use the last row
2730 0 ▶ $row_num = $self->{$section}[$section_num]->{last_row} if $row_num == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row_num == -1 0 0 0
2731
2732 # Deleting the last row
2733 #if ( $row_num == $self->{$section}[$section_num]->{last_row} ) {
2734 # $self->{$section}[$section_num]->{rows}[$row_num] = undef;
2735 #}
2736
2737 0 splice ( @{$self->{$section}[$section_num]->{rows}}, $row_num, 1 );
2738
2739 0 $self->{$section}[$section_num]->{last_row}--; # decrement number of rows
2740 0 return $self->{$section}[$section_num]{last_row};
2741
2742 }
2743  
2744 #-------------------------------------------------------
2745 # Subroutine: delRow(row_num)
2746 # Author: Anthony Peacock
2747 # Date: 10 April 2008
2748 # Modified:
2749 #-------------------------------------------------------
2750 0 ▶sub delRow {
Subroutine delRow: not called CC=1 SCAR=6.9
Pod documented
2751 0 my $self = shift;
2752 0 my $row_num = shift;
2753  
2754 0 my $last_row = $self->delSectionRow ( 'tbody', 0, $row_num );
2755 0 return $last_row;
2756 }
2757  
2758 #-------------------------------------------------------
2759 # Subroutine: setSectionRowAlign('section', section_num, row_num, [center|right|left])
2760 # Author: Anthony Peacock
2761 # Date: 11 Sept 2007
2762 # Based on: setRowAlign
2763 #-------------------------------------------------------
2764 0 ▶sub setSectionRowAlign {
Subroutine setSectionRowAlign: not called CC=9 SCAR=45.0
Pod documented
2765 0 my $self = shift;
2766 0 my $section = shift;
2767 0 my $section_num = shift;
2768 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2769 0 my $align = shift;
2770
2771 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2772 0 print STDERR "\nsetSectionRowAlign: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2773 0 return 0;
2774 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2775 0 print STDERR "\nsetSectionRowAlign: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2776 0 return 0;
2777 }
2778  
2779 # If -1 is used in the row parameter, use the last row
2780 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2781  
2782 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{'last_row'} or $row < 1) { } 0 0 0
elsif (not $align =~ /left|right|center/i) { } 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2783 0 print STDERR "\n$0:setSectionRowAlign: Invalid table reference" ;
2784 0 return 0;
2785 } elsif ( $align !~ /left|right|center/i ) {
2786 0 print STDERR "\nsetSectionRowAlign: Alignment can be : 'left | right | center' : Cur value: $align\n";
2787 0 return 0;
2788 }
2789
2790 0 $self->{$section}[$section_num]->{rows}[$row]->{align} = $align ;
2791 }
2792  
2793 #-------------------------------------------------------
2794 # Subroutine: setRowAlign(row_num, [center|right|left])
2795 # Author: Stacy Lacy
2796 # Date: 30 Jul 1997
2797 # Modified: 05 Jan 2002 - Arno Teunisse
2798 # Modified: 10 Jan 2002 - Anthony Peacock
2799 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2800 # Modified: 11 Sept 2007 - Anthony Peacock
2801 #-------------------------------------------------------
2802 0 ▶sub setRowAlign {
Subroutine setRowAlign: not called CC=2 SCAR=17.9
Pod documented
2803 0 my $self = shift;
2804 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2805 0 my $align = shift;
2806  
2807 0 $self->setSectionRowAlign ( 'tbody', 0, $row, $align );
2808 }
2809  
2810 #-------------------------------------------------------
2811 # Subroutine: setSectionRowStyle
2812 # Comment: to insert a css style the <tr > Tag
2813 # Author: Anthony Peacock
2814 # Date: 11 Sept 2007
2815 # Based on: setRowStyle by Arno Teunisse
2816 #-------------------------------------------------------
2817 0 ▶sub setSectionRowStyle {
Subroutine setSectionRowStyle: not called CC=8 SCAR=42.8
Pod documented
2818 0 my $self = shift;
2819 0 my $section = shift;
2820 0 my $section_num = shift;
2821 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2822 0 my $html_str = shift;
2823
2824 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2825 0 print STDERR "\nsetSectionRowStyle: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2826 0 return 0;
2827 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2828 0 print STDERR "\nsetSectionRowStyle: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2829 0 return 0;
2830 }
2831  
2832 # If -1 is used in the row parameter, use the last row
2833 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2834  
2835 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2836 0 print STDERR "\n$0:setSectionRowStyle: Invalid table reference" ;
2837 0 return 0;
2838 }
2839
2840 0 $self->{$section}[$section_num]->{rows}[$row]->{style} = $html_str ;
2841 }
2842  
2843 #-------------------------------------------------------
2844 # Subroutine: setRowStyle
2845 # Comment: to insert a css style the <tr > Tag
2846 # Author: Arno Teunisse
2847 # Date: 05 Jan 2002
2848 # Modified: 10 Jan 2002 - Anthony Peacock
2849 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2850 # Modified: 11 Sept 2007 - Anthony Peaock
2851 #-------------------------------------------------------
2852 0 ▶sub setRowStyle {
Subroutine setRowStyle: not called CC=2 SCAR=17.9
Pod documented
2853 0 my $self = shift;
2854 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2855 0 my $html_str = shift;
2856  
2857 0 $self->setSectionRowStyle ( 'tbody', 0, $row, $html_str );
2858 }
2859  
2860 #-------------------------------------------------------
2861 # Subroutine: setSectionRowClass
2862 # Comment: to insert a css class in the <tr > Tag
2863 # Author: Anthony Peacock (based on setRowStyle by Arno Teunisse)
2864 # Date: 11 Sept 2007
2865 # Based on: setRowClass
2866 #-------------------------------------------------------
2867 0 ▶sub setSectionRowClass {
Subroutine setSectionRowClass: not called CC=8 SCAR=42.8
Pod documented
2868 0 my $self = shift;
2869 0 my $section = shift;
2870 0 my $section_num = shift;
2871 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2872 0 my $html_str = shift;
2873
2874 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2875 0 print STDERR "\nsetSectionRowClass: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2876 0 return 0;
2877 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2878 0 print STDERR "\nsetSectionRowClass: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2879 0 return 0;
2880 }
2881  
2882 # If -1 is used in the row parameter, use the last row
2883 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2884  
2885 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2886 0 print STDERR "\n$0:setSectionRowClass: Invalid table reference" ;
2887 0 return 0;
2888 }
2889
2890 0 $self->{$section}[$section_num]->{rows}[$row]->{class} = $html_str ;
2891 }
2892  
2893 #-------------------------------------------------------
2894 # Subroutine: setRowClass
2895 # Comment: to insert a css class in the <tr > Tag
2896 # Author: Anthony Peacock (based on setRowStyle by Arno Teunisse)
2897 # Date: 22 July 2002
2898 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2899 # Modified: 11 Sept 2007 - Anthony Peacock
2900 #-------------------------------------------------------
2901 0 ▶sub setRowClass {
Subroutine setRowClass: not called CC=2 SCAR=17.9
Pod documented
2902 0 my $self = shift;
2903 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2904 0 my $html_str = shift;
2905
2906 0 $self->setSectionRowClass ( 'tbody', 0, $row, $html_str );
2907 }
2908  
2909  
2910 #-------------------------------------------------------
2911 # Subroutine: setSectionRowVAlign('section', section_num, row_num, [center|top|bottom])
2912 # Author: Anthony Peacock
2913 # Date: 11 Sept 2007
2914 # Based on: setRowVAlign
2915 #-------------------------------------------------------
2916 0 ▶sub setSectionRowVAlign {
Subroutine setSectionRowVAlign: not called CC=8 SCAR=42.8
Pod documented
2917 0 my $self = shift;
2918 0 my $section = shift;
2919 0 my $section_num = shift;
2920 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2921 0 my $valign = shift;
2922  
2923 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2924 0 print STDERR "\nsetSectionRowVAlign: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2925 0 return 0;
2926 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2927 0 print STDERR "\nsetSectionRowVAlign: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2928 0 return 0;
2929 }
2930
2931 # If -1 is used in the row parameter, use the last row
2932 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2933  
2934 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2935 0 print STDERR "\n$0:setSectionRowVAlign: Invalid table reference" ;
2936 0 return 0;
2937 }
2938
2939 0 $self->{$section}[$section_num]->{rows}[$row]->{valign} = $valign ;
2940 }
2941  
2942 #-------------------------------------------------------
2943 # Subroutine: setRowVAlign(row_num, [center|top|bottom])
2944 # Author: Stacy Lacy
2945 # Date: 30 Jul 1997
2946 # Modified: 23 Oct 2003 - Anthony Peacock
2947 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2948 # Modified: 11 Sept 2007 - Anthony Peacock
2949 #-------------------------------------------------------
2950 0 ▶sub setRowVAlign {
Subroutine setRowVAlign: not called CC=2 SCAR=17.9
Pod documented
2951 0 my $self = shift;
2952 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2953 0 my $valign = shift;
2954
2955 0 $self->setSectionRowVAlign ( 'tbody', 0, $row, $valign );
2956 }
2957  
2958 #-------------------------------------------------------
2959 # Subroutine: setSectionRowNoWrap('section', section_num, row_num, [0|1])
2960 # Author: Anthony Peacock
2961 # Date: 11 September 2007
2962 # Based on: setRowNoWrap
2963 #-------------------------------------------------------
2964 0 ▶sub setSectionRowNoWrap {
Subroutine setSectionRowNoWrap: not called CC=8 SCAR=42.8
Pod documented
2965 0 my $self = shift;
2966 0 my $section = shift;
2967 0 my $section_num = shift;
2968 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
2969 0 my $value = shift;
2970
2971 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
2972 0 print STDERR "\nsetSectionRowNoWrap: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
2973 0 return 0;
2974 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
2975 0 print STDERR "\nsetSectionRowNoWrap: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
2976 0 return 0;
2977 }
2978
2979 # If -1 is used in the row parameter, use the last row
2980 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
2981  
2982 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
2983 0 print STDERR "\n$0:setSectionRowNoWrap: Invalid table reference" ;
2984 0 return 0;
2985 }
2986
2987 0 $self->{$section}[$section_num]->{rows}[$row]->{nowrap} = $value ;
2988 }
2989  
2990 #-------------------------------------------------------
2991 # Subroutine: setRowNoWrap(row_num, [0|1])
2992 # Author: Anthony Peacock
2993 # Date: 22 Feb 2001
2994 # Modified: 23 Oct 2003 - Anthony Peacock
2995 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
2996 # Modified: 11 September 2007 - Anthony Peacock
2997 #-------------------------------------------------------
2998 0 ▶sub setRowNoWrap {
Subroutine setRowNoWrap: not called CC=2 SCAR=17.9
Pod documented
2999 0 my $self = shift;
3000 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3001 0 my $value = shift;
3002
3003 0 $self->setSectionRowNoWrap ( 'tbody', 0, $row, $value ) ;
3004 }
3005  
3006 #-------------------------------------------------------
3007 # Subroutine: setSectionRowBGColor('section', section_num, row_num, [colorname|colortriplet])
3008 # Author: Anthony Peacock
3009 # Date: 10 Sep 2007
3010 # Based On: setRowBGColor
3011 #-------------------------------------------------------
3012 0 ▶sub setSectionRowBGColor {
Subroutine setSectionRowBGColor: not called CC=8 SCAR=42.8
Pod documented
3013 0 my $self = shift;
3014 0 my $section = lc(shift);
3015 0 my $section_num = shift;
3016 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3017 0 my $value = shift;
3018
3019 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3020 0 print STDERR "\nsetSectionRowBGColor: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3021 0 return 0;
3022 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3023 0 print STDERR "\nsetSectionRowBGColor: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3024 0 return 0;
3025 }
3026  
3027 # If -1 is used in the row parameter, use the last row
3028 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
3029  
3030 # You cannot set a nonexistent row
3031 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
3032 0 print STDERR "\n$0:setSectionRowBGColor: Invalid table reference" ;
3033 0 return 0;
3034 }
3035
3036 0 $self->{$section}[$section_num]->{rows}[$row]->{bgcolor} = $value ;
3037 }
3038  
3039 #-------------------------------------------------------
3040 # Subroutine: setRowBGColor(row_num, [colorname|colortriplet])
3041 # Author: Arno Teunisse
3042 # Date: 08 Jan 2002
3043 # Modified: 10 Jan 2002 - Anthony Peacock
3044 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
3045 # Modified: 10 Sept 2007 - Anthony Peacock
3046 #-------------------------------------------------------
3047 0 ▶sub setRowBGColor {
Subroutine setRowBGColor: not called CC=2 SCAR=17.9
Pod documented
3048 0 my $self = shift;
3049 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3050 0 my $value = shift;
3051
3052 0 $self->setSectionRowBGColor ( 'tbody', 0, $row, $value );
3053 }
3054  
3055 #-------------------------------------------------------
3056 # Subroutine: setSectionRowAttr('section', section_num, row, "Attribute string")
3057 # Comment: To add user defined attribute to specified row in a section
3058 # Author: Anthony Peacock
3059 # Date: 10 September 2007
3060 # Modified:
3061 #-------------------------------------------------------
3062 0 ▶sub setSectionRowAttr {
Subroutine setSectionRowAttr: not called CC=8 SCAR=42.8
Pod documented
3063 0 my $self = shift;
3064 0 my $section = lc(shift);
3065 0 my $section_num = shift;
3066 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3067 0 my $html_str = shift;
3068  
3069 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3070 0 print STDERR "\nsetSectionRowAttr: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3071 0 return 0;
3072 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3073 0 print STDERR "\nsetSectionRowAttr: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3074 0 return 0;
3075 }
3076
3077 # If -1 is used in the row parameter, use the last row
3078 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
3079  
3080 # You cannot set a nonexistent row
3081 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
3082 0 print STDERR "\n$0:setRowAttr: Invalid table reference" ;
3083 0 return 0;
3084 }
3085
3086 0 $self->{$section}[$section_num]->{rows}[$row]->{attr} = $html_str;
3087 }
3088  
3089 #-------------------------------------------------------
3090 # Subroutine: setRowAttr(row, "Attribute string")
3091 # Comment: To add user defined attribute to specified row
3092 # Author: Anthony Peacock
3093 # Date: 10 Jan 2002
3094 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
3095 #-------------------------------------------------------
3096 0 ▶sub setRowAttr {
Subroutine setRowAttr: not called CC=2 SCAR=17.9
Pod documented
3097 0 my $self = shift;
3098 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3099 0 my $html_str = shift;
3100  
3101 0 $self->setSectionRowAttr ( 'tbody', 0, $row, $html_str );
3102 }
3103  
3104 # ----- Routines that work across a Row's Cells
3105  
3106 #-------------------------------------------------------
3107 # Subroutine: setSectionRCellsHead('section', section_num, row_num, [0|1])
3108 # Author: Anthony Peacock
3109 # Date: 10 April 2008
3110 # Based on: setRowHead
3111 #-------------------------------------------------------
3112 0 ▶sub setSectionRCellsHead {
Subroutine setSectionRCellsHead: not called CC=10 SCAR=47.0
Pod documented
3113 0 my $self = shift;
3114 0 my $section = shift;
3115 0 my $section_num = shift;
3116 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3117 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3118
3119 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3120 0 print STDERR "\nasetSectionRowHead: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3121 0 return 0;
3122 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3123 0 print STDERR "\nsetSectionRowHead: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3124 0 return 0;
3125 }
3126  
3127 # If -1 is used in the row parameter, use the last row
3128 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
3129  
3130 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
3131 0 print STDERR "\n$0:setSectionRowHead: Invalid table reference" ;
3132 0 return 0;
3133 }
3134  
3135 # this sub should change the head flag of a row;
3136 0 my $i;
3137 0 ▶ for ($i=1;$i <= $self->{last_col};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{"last_col"}) 0 0 0
3138 0 $self->setSectionCellHead($section, $section_num, $row, $i, $value);
3139 }
3140 }
3141  
3142 #-------------------------------------------------------
3143 # Subroutine: setSectionRowHead('section', section_num, row_num, [0|1])
3144 # Author: Anthony Peacock
3145 # Date: 10 April 2008
3146 # Based on: setRowHead
3147 # Status: Deprecated by setSectionRCellsHead
3148 #-------------------------------------------------------
3149 0 ▶sub setSectionRowHead {
Subroutine setSectionRowHead: not called CC=3 SCAR=24.8
Pod documented
3150 0 my $self = shift;
3151 0 my $section = shift;
3152 0 my $section_num = shift;
3153 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3154 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3155
3156 0 return $self->setSectionRCellsHead ( $section, $section_num, $row, $value );
3157 }
3158  
3159 #-------------------------------------------------------
3160 # Subroutine: setRCellsHead(row_num, [0|1])
3161 # Author: Anthony Peacock
3162 # Date: 10 April 2008
3163 #-------------------------------------------------------
3164 0 ▶sub setRCellsHead {
Subroutine setRCellsHead: not called CC=3 SCAR=24.8
Pod documented
3165 0 my $self = shift;
3166 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3167 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3168  
3169 0 $self->setSectionRCellsHead ( 'tbody', 0, $row, $value);
3170 }
3171  
3172 #-------------------------------------------------------
3173 # Subroutine: setRowHead(row_num, [0|1])
3174 # Author: Stacy Lacy
3175 # Date: 30 Jul 1997
3176 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
3177 # Modified: 10 April 2008 - Anthony Peacock
3178 # Status: Deprecated by setRCellsHead
3179 #-------------------------------------------------------
3180 0 ▶sub setRowHead {
Subroutine setRowHead: not called CC=3 SCAR=24.8
Pod documented
3181 0 my $self = shift;
3182 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3183 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3184  
3185 0 $self->setSectionRCellsHead ( 'tbody', 0, $row, $value);
3186 }
3187  
3188 #-------------------------------------------------------
3189 # Subroutine: setSectionRCellsWidth('Section', section_num', row_num, [pixels|percentoftable])
3190 # Author: Anthony Peacock
3191 # Date: 10 April 2008
3192 # Based on: setRowWidth
3193 #-------------------------------------------------------
3194 0 ▶sub setSectionRCellsWidth {
Subroutine setSectionRCellsWidth: not called CC=9 SCAR=45.0
Pod documented
3195 0 my $self = shift;
3196 0 my $section = lc(shift);
3197 0 my $section_num = shift;
3198 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3199 0 my $value = shift;
3200
3201 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3202 0 print STDERR "\nsetSectionRCellsWidth: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3203 0 return 0;
3204 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3205 0 print STDERR "\nsetSectionRCellsWidth: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3206 0 return 0;
3207 }
3208
3209 # If -1 is used in the row parameter, use the last row
3210 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
3211  
3212 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
3213 0 print STDERR "\n$0:setSectionRCellsWidth: Invalid table reference" ;
3214 0 return 0;
3215 }
3216  
3217 # this sub should change the cell width of a row;
3218 0 my $i;
3219 0 ▶ for ($i=1;$i <= $self->{last_col};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{"last_col"}) 0 0 0
3220 0 $self->setSectionCellWidth($section, $section_num, $row, $i, $value);
3221 }
3222 }
3223  
3224 #-------------------------------------------------------
3225 # Subroutine: setSectionRowWidth('Section', section_num', row_num, [pixels|percentoftable])
3226 # Author: Anthony Peacock
3227 # Date: 10 Sept 2007
3228 # Modified: 10 April 2008
3229 # Based on: setRowWidth
3230 # Status: Deprecated by setSectionRCellsWidth
3231 #-------------------------------------------------------
3232 0 ▶sub setSectionRowWidth {
Subroutine setSectionRowWidth: not called CC=2 SCAR=17.9
Pod documented
3233 0 my $self = shift;
3234 0 my $section = lc(shift);
3235 0 my $section_num = shift;
3236 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3237 0 my $value = shift;
3238  
3239 0 return $self->setSectionRCellsWidth ( $section, $section_num, $row, $value );
3240 }
3241  
3242 #-------------------------------------------------------
3243 # Subroutine: setRCellsWidth(row_num, [pixels|percentoftable])
3244 # Author: Anthony Peacock
3245 # Date: 22 Feb 2001
3246 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
3247 # Modified: 10 April 2008 - Anthony Peacock
3248 #-------------------------------------------------------
3249 0 ▶sub setRCellsWidth {
Subroutine setRCellsWidth: not called CC=2 SCAR=17.9
Pod documented
3250 0 my $self = shift;
3251 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3252 0 my $value = shift;
3253
3254 0 $self->setSectionRCellsWidth( 'tbody', 0, $row, $value);
3255 }
3256  
3257 #-------------------------------------------------------
3258 # Subroutine: setRowWidth(row_num, [pixels|percentoftable])
3259 # Author: Anthony Peacock
3260 # Date: 22 Feb 2001
3261 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
3262 # Modified: 10 April 2008 - Anthony Peacock
3263 # Status: Deprecated by setRCellsWidth
3264 #-------------------------------------------------------
3265 0 ▶sub setRowWidth {
Subroutine setRowWidth: not called CC=2 SCAR=17.9
Pod documented
3266 0 my $self = shift;
3267 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3268 0 my $value = shift;
3269
3270 0 $self->setSectionRCellsWidth( 'tbody', 0, $row, $value);
3271 }
3272  
3273 #-------------------------------------------------------
3274 # Subroutine: setSectionRCellsHeight("Section", section_num, row_num, [pixels])
3275 # Author: Anthony Peacock
3276 # Date: 10 April 2008
3277 # Based on: setRowHeight
3278 #-------------------------------------------------------
3279 0 ▶sub setSectionRCellsHeight {
Subroutine setSectionRCellsHeight: not called CC=9 SCAR=45.0
Pod documented
3280 0 my $self = shift;
3281 0 my $section = lc(shift);
3282 0 my $section_num = shift;
3283 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3284 0 my $value = shift;
3285
3286 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3287 0 print STDERR "\nsetSectionRCellsHeight: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3288 0 return 0;
3289 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3290 0 print STDERR "\nsetSectionRCellsHeight: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3291 0 return 0;
3292 }
3293
3294 # If -1 is used in the row parameter, use the last row
3295 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
3296  
3297 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
3298 0 print STDERR "\n$0:setSectionRCellsHeight: Invalid table reference" ;
3299 0 return 0;
3300 }
3301  
3302 # this sub should change the cell height of a row;
3303 0 my $i;
3304 0 ▶ for ($i=1;$i <= $self->{last_col};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{"last_col"}) 0 0 0
3305 0 $self->setSectionCellHeight($section, $section_num, $row, $i, $value);
3306 }
3307 }
3308  
3309 #-------------------------------------------------------
3310 # Subroutine: setSectionRowHeight("Section", section_num, row_num, [pixels])
3311 # Author: Anthony Peacock
3312 # Date: 10 Sept 2007
3313 # Modified: 10 April 2008
3314 # Based on: setRowHeight
3315 # Status: Deprecated by setSectionRCellsHeight
3316 #-------------------------------------------------------
3317 0 ▶sub setSectionRowHeight {
Subroutine setSectionRowHeight: not called CC=2 SCAR=17.9
Pod documented
3318 0 my $self = shift;
3319 0 my $section = lc(shift);
3320 0 my $section_num = shift;
3321 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3322 0 my $value = shift;
3323
3324 0 return $self->setSectionRCellsHeight ( $section, $section_num, $row, $value );
3325 }
3326  
3327 #-------------------------------------------------------
3328 # Subroutine: setRCellsHeight(row_num, [pixels])
3329 # Author: Anthony Peacock
3330 # Date: 10 April 2008
3331 # Based on: setRowHeight
3332 #-------------------------------------------------------
3333 0 ▶sub setRCellsHeight {
Subroutine setRCellsHeight: not called CC=2 SCAR=17.9
Pod documented
3334 0 my $self = shift;
3335 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3336 0 my $value = shift;
3337
3338 0 $self->setSectionRCellsHeight('tbody', 0, $row, $value);
3339 }
3340  
3341 #-------------------------------------------------------
3342 # Subroutine: setRowHeight(row_num, [pixels])
3343 # Author: Anthony Peacock
3344 # Date: 22 Feb 2001
3345 # Modified: 10 April 2008
3346 # Status: Deprecated by setRCellsHeight
3347 #-------------------------------------------------------
3348 0 ▶sub setRowHeight {
Subroutine setRowHeight: not called CC=2 SCAR=17.9
Pod documented
3349 0 my $self = shift;
3350 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3351 0 my $value = shift;
3352
3353 0 $self->setSectionRCellsHeight('tbody', 0, $row, $value);
3354 }
3355  
3356  
3357 #-------------------------------------------------------
3358 # Subroutine: setSectionRCellsFormat('section', section_num, row_num, start_string, end_string)
3359 # Author: Anthony Peacock
3360 # Date: 10 April 2008
3361 # Base on: setSectionRowFormat
3362 #-------------------------------------------------------
3363 0 ▶sub setSectionRCellsFormat {
Subroutine setSectionRCellsFormat: not called CC=9 SCAR=45.0
Pod documented
3364 0 my $self = shift;
3365 0 my $section = lc(shift);
3366 0 my $section_num = shift;
3367 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3368 0 my ($start_string, $end_string) = @_;
3369
3370 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3371 0 print STDERR "\nsetSectionRCellsFormat: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3372 0 return 0;
3373 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3374 0 print STDERR "\nsetSectionRCellsFormat: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3375 0 return 0;
3376 }
3377
3378 # If -1 is used in the row parameter, use the last row
3379 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
3380  
3381 # You cannot set a nonexistent row
3382 0 ▶ if ( $row > $self->{$section}[$section_num]->{last_row} || $row < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
3383 0 print STDERR "\n$0:setSectionRCellsFormat: Invalid table reference" ;
3384 0 return 0;
3385 }
3386  
3387 # this sub should set format strings for each
3388 # cell in a row given a row number;
3389 0 my $i;
3390 0 ▶ for ($i=1;$i <= $self->{last_col};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{"last_col"}) 0 0 0
3391 0 $self->setSectionCellFormat($section, $section_num, $row,$i, $start_string, $end_string);
3392 }
3393 }
3394  
3395 #-------------------------------------------------------
3396 # Subroutine: setSectionRowFormat('section', section_num, row_num, start_string, end_string)
3397 # Author: Anthony Peacock
3398 # Date: 10 September 2007
3399 # Modified: 10 April 2008
3400 # Status: Deprecated by setSectionRCellsFormat
3401 #-------------------------------------------------------
3402 0 ▶sub setSectionRowFormat {
Subroutine setSectionRowFormat: not called CC=2 SCAR=17.9
Pod documented
3403 0 my $self = shift;
3404 0 my $section = lc(shift);
3405 0 my $section_num = shift;
3406 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3407 0 my ($start_string, $end_string) = @_;
3408  
3409 0 return $self->setSectionRCellsFormat ( $section, $section_num, $row, $start_string, $end_string );
3410 }
3411  
3412 #-------------------------------------------------------
3413 # Subroutine: setRCellsFormat(row_num, start_string, end_string)
3414 # Author: Anthony Peacock
3415 # Date: 21 Feb 2001
3416 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
3417 # Modified: 10 April 2008 - Anthony Peacock
3418 #-------------------------------------------------------
3419 0 ▶sub setRCellsFormat {
Subroutine setRCellsFormat: not called CC=2 SCAR=17.9
Pod documented
3420 0 my $self = shift;
3421 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3422 0 my ($start_string, $end_string) = @_;
3423
3424 0 $self->setSectionRCellsFormat( 'tbody', 0, $row, $start_string, $end_string);
3425 }
3426  
3427 #-------------------------------------------------------
3428 # Subroutine: setRowFormat(row_num, start_string, end_string)
3429 # Author: Anthony Peacock
3430 # Date: 21 Feb 2001
3431 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
3432 # Modified: 10 September 2007 - Anthony Peacock
3433 # Status: Deprecated by setRCellsFormat
3434 #-------------------------------------------------------
3435 0 ▶sub setRowFormat {
Subroutine setRowFormat: not called CC=2 SCAR=17.9
Pod documented
3436 0 my $self = shift;
3437 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
3438 0 my ($start_string, $end_string) = @_;
3439
3440 0 $self->setSectionRCellsFormat( 'tbody', 0, $row, $start_string, $end_string);
3441 }
3442  
3443 #-------------------------------------------------------
3444 # Subroutine: getSectionRowStyle('section', section_num, $row_num)
3445 # Author: Anthony Peacock
3446 # Date: 10 September 2007
3447 # Description: getter for row style, using sections
3448 # Based on: getRowStyle
3449 #-------------------------------------------------------
3450 0 ▶sub getSectionRowStyle {
Subroutine getSectionRowStyle: not called CC=5 SCAR=34.0
Pod documented
3451 0 my ($self, $section, $section_num, $row) = @_;
3452
3453 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3454 0 print STDERR "\ngetSectionRowStyle: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3455 0 return 0;
3456 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3457 0 print STDERR "\ngetSectionRowStyle: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3458 0 return 0;
3459 }
3460  
3461 return $self->_checkRowAndCol('getRowStyle', $section, $section_num, {row => $row})
3462 ? $self->{$section}[$section_num]->{rows}[$row]->{style}
3463 0 ▶ : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->_checkRowAndCol('getRowStyle', $section, $section_num, {'row', $row}) ? : 0 0 0
3464 }
3465  
3466 #-------------------------------------------------------
3467 # Subroutine: getRowStyle($row_num)
3468 # Author: Douglas Riordan
3469 # Date: 1 Dec 2005
3470 # Description: getter for row style
3471 # Modified: 10 September 2007 - Anthony Peacock
3472 #-------------------------------------------------------
3473 0 ▶sub getRowStyle {
Subroutine getRowStyle: not called CC=1 SCAR=6.9
Pod documented
3474 0 my ($self, $row) = @_;
3475  
3476 0 return $self->getSectionRowStyle ( 'tbody', 0, $row );
3477 }
3478  
3479 #-------------------------------------------------------
3480 # Col config methods
3481 #
3482 #-------------------------------------------------------
3483  
3484 #-------------------------------------------------------
3485 # Subroutine: addSectionCol('section', section_num, "cell 1 content" [, "cell 2 content", ...])
3486 # Author: Anthony Peacock
3487 # Date: 11 Sept 2007
3488 # Based on: addCol
3489 #-------------------------------------------------------
3490 0 ▶sub addSectionCol {
Subroutine addSectionCol: not called CC=6 SCAR=37.4
Pod documented
3491 0 my $self = shift;
3492 0 my $section = shift;
3493 0 my $section_num = shift;
3494
3495 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3496 0 print STDERR "\naddSectionCol: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3497 0 return 0;
3498 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3499 0 print STDERR "\naddSectionCol: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3500 0 return 0;
3501 }
3502
3503 # this sub should add a column, using @_ as contents
3504 0 my $count= @_;
3505 # if number of cells is greater than rows, let's assume
3506 # we want to add a row.
3507 0 ▶ $self->{$section}[$section_num]->{last_row} = $count if ($count >$self->{$section}[$section_num]->{last_row});
Branch: 1 branch
BranchTrueFalseTotal
if $count > $self->{$section}[$section_num]{"last_row"} 0 0 0
3508 0 $self->{last_col}++; # increment number of rows
3509 0 my $i;
3510 0 ▶ for ($i=1;$i <= $count;$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $count) 0 0 0
3511 # Store each value in cell on row
3512 0 $self->{$section}[$section_num]->{rows}[$i]->{cells}[$self->{last_col}]->{contents} = shift;
3513 }
3514 0 return $self->{last_col};
3515  
3516 }
3517  
3518 #-------------------------------------------------------
3519 # Subroutine: addCol("cell 1 content" [, "cell 2 content", ...])
3520 # Author: Stacy Lacy
3521 # Date: 30 Jul 1997
3522 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
3523 # Modified: 11 Sept 2007 - Anthony Peacock
3524 #-------------------------------------------------------
3525 0 ▶sub addCol {
Subroutine addCol: not called CC=1 SCAR=6.9
Pod documented
3526 0 my $self = shift;
3527 0 return $self->addSectionCol ( 'tbody', 0, @_ );
3528 }
3529  
3530 #-------------------------------------------------------
3531 # Subroutine: setSectionColAlign('section', section_num, col_num, [center|right|left])
3532 # Author: Anthony Peacock
3533 # Date: 11 Sept 2007
3534 # Based on: setColAlign
3535 #-------------------------------------------------------
3536 0 ▶sub setSectionColAlign {
Subroutine setSectionColAlign: not called CC=9 SCAR=45.0
Pod documented
3537 0 my $self = shift;
3538 0 my $section = shift;
3539 0 my $section_num = shift;
3540 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3541 0 my $align = shift;
3542
3543 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3544 0 print STDERR "\nsetSectionColAlign: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3545 0 return 0;
3546 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3547 0 print STDERR "\nsetSectionColAlign: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3548 0 return 0;
3549 }
3550  
3551 # If -1 is used in the col parameter, use the last col
3552 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
3553  
3554 # You cannot set a nonexistent row
3555 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
3556 0 print STDERR "\n$0:setSectionColAlign: Invalid table reference" ;
3557 0 return 0;
3558 }
3559  
3560 # this sub should align a col given a col number;
3561 0 my $i;
3562 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
3563 0 $self->setSectionCellAlign($section, $section_num, $i, $col, $align);
3564 }
3565 }
3566  
3567 #-------------------------------------------------------
3568 # Subroutine: setColAlign(col_num, [center|right|left])
3569 # Author: Stacy Lacy
3570 # Date: 30 Jul 1997
3571 # Modified: 11 Sept 2007 Anthony Peacock
3572 #-------------------------------------------------------
3573 0 ▶sub setColAlign {
Subroutine setColAlign: not called CC=2 SCAR=17.9
Pod documented
3574 0 my $self = shift;
3575 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3576 0 my $align = shift;
3577  
3578 0 $self->setSectionColAlign ( 'tbody', 0, $col, $align );
3579 }
3580  
3581 #-------------------------------------------------------
3582 # Subroutine: setSectionColVAlign('section', section_num, col_num, [center|top|bottom])
3583 # Author: Anthony Peacock
3584 # Date: 11 Sept 2007
3585 # Based on: setColVAlign
3586 #-------------------------------------------------------
3587 0 ▶sub setSectionColVAlign {
Subroutine setSectionColVAlign: not called CC=9 SCAR=45.0
Pod documented
3588 0 my $self = shift;
3589 0 my $section = shift;
3590 0 my $section_num = shift;
3591 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3592 0 my $valign = shift;
3593
3594 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3595 0 print STDERR "\nsetSectionColVAlign: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3596 0 return 0;
3597 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3598 0 print STDERR "\nsetSectionColVAlign: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3599 0 return 0;
3600 }
3601  
3602 # If -1 is used in the col parameter, use the last col
3603 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
3604  
3605 # You cannot set a nonexistent row
3606 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
3607 0 print STDERR "\n$0:setSectionColVAlign: Invalid table reference" ;
3608 0 return 0;
3609 }
3610  
3611 # this sub should align a all rows given a column number;
3612 0 my $i;
3613 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
3614 0 $self->setSectionCellVAlign($section, $section_num, $i,$col, $valign);
3615 }
3616 }
3617  
3618 #-------------------------------------------------------
3619 # Subroutine: setColVAlign(col_num, [center|top|bottom])
3620 # Author: Stacy Lacy
3621 # Date: 30 Jul 1997
3622 # Modified: 11 Sept 2007 - Anthony Peacock
3623 #-------------------------------------------------------
3624 0 ▶sub setColVAlign {
Subroutine setColVAlign: not called CC=2 SCAR=17.9
Pod documented
3625 0 my $self = shift;
3626 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3627 0 my $valign = shift;
3628  
3629 0 $self->setSectionColVAlign( 'tbody', 0, $col, $valign);
3630 }
3631  
3632 #-------------------------------------------------------
3633 # Subroutine: setSectionColHead('section', section_num, col_num, [0|1])
3634 # Author: Anthony Peacock
3635 # Date: 11 Sept 2007
3636 # Based on: setColHead
3637 #-------------------------------------------------------
3638 0 ▶sub setSectionColHead {
Subroutine setSectionColHead: not called CC=10 SCAR=47.0
Pod documented
3639 0 my $self = shift;
3640 0 my $section = shift;
3641 0 my $section_num = shift;
3642 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3643 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3644  
3645 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3646 0 print STDERR "\nsetSectionColHead: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3647 0 return 0;
3648 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3649 0 print STDERR "\nsetSectionColHead: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3650 0 return 0;
3651 }
3652  
3653 # If -1 is used in the col parameter, use the last col
3654 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
3655  
3656 # You cannot set a nonexistent row
3657 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
3658 0 print STDERR "\n$0:setSectionColHead: Invalid table reference" ;
3659 0 return 0;
3660 }
3661  
3662 # this sub should set the head attribute of a col given a col number;
3663 0 my $i;
3664 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
3665 0 $self->setSectionCellHead($section, $section_num, $i, $col, $value);
3666 }
3667 }
3668  
3669 #-------------------------------------------------------
3670 # Subroutine: setColHead(col_num, [0|1])
3671 # Author: Jay Flaherty
3672 # Date: 30 Mar 1998
3673 # Modified: 11 Sept 2007 - Anthony Peacock
3674 #-------------------------------------------------------
3675 0 ▶sub setColHead {
Subroutine setColHead: not called CC=3 SCAR=24.8
Pod documented
3676 0 my $self = shift;
3677 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3678 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3679
3680 0 $self->setSectionColHead( 'tbody', 0, $col, $value);
3681 }
3682  
3683 #-------------------------------------------------------
3684 # Subroutine: setSectionColNoWrap('section', section_num, row_num, col_num, [0|1])
3685 # Author: Anthony Peacock
3686 # Date: 11 Sept 2007
3687 # Based on: setColNoWrap
3688 #-------------------------------------------------------
3689 0 ▶sub setSectionColNoWrap {
Subroutine setSectionColNoWrap: not called CC=9 SCAR=45.0
Pod documented
3690 0 my $self = shift;
3691 0 my $section = shift;
3692 0 my $section_num = shift;
3693 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3694 0 my $value = shift;
3695
3696 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3697 0 print STDERR "\nsetSectionColNoWrap: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3698 0 return 0;
3699 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3700 0 print STDERR "\nsetSectionColNoWrap: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3701 0 return 0;
3702 }
3703  
3704 # If -1 is used in the col parameter, use the last col
3705 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
3706  
3707 # You cannot set a nonexistent row
3708 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
3709 0 print STDERR "\n$0:setSectionColNoWrap: Invalid table reference" ;
3710 0 return 0;
3711 }
3712  
3713 # this sub should change the wrap flag of a column;
3714 0 my $i;
3715 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
3716 0 $self->setSectionCellNoWrap($section, $section_num, $i,$col, $value);
3717 }
3718 }
3719  
3720 #-------------------------------------------------------
3721 # Subroutine: setColNoWrap(row_num, col_num, [0|1])
3722 # Author: Stacy Lacy
3723 # Date: 30 Jul 1997
3724 # Modified: 11 Sept 2007 - Anthony Peacock
3725 #-------------------------------------------------------
3726 0 ▶sub setColNoWrap {
Subroutine setColNoWrap: not called CC=2 SCAR=17.9
Pod documented
3727 0 my $self = shift;
3728 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3729 0 my $value = shift;
3730  
3731 0 $self->setSectionColNoWrap( 'tbody', 0, $col, $value);
3732 }
3733  
3734 #-------------------------------------------------------
3735 # Subroutine: setSectionColWidth('section', section_num, col_num, [pixels|percentoftable])
3736 # Author: Anthony Peacock
3737 # Date: 12 Sept 2007
3738 # Based on: setColWidth
3739 #-------------------------------------------------------
3740 0 ▶sub setSectionColWidth {
Subroutine setSectionColWidth: not called CC=9 SCAR=45.0
Pod documented
3741 0 my $self = shift;
3742 0 my $section = shift;
3743 0 my $section_num = shift;
3744 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3745 0 my $value = shift;
3746
3747 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3748 0 print STDERR "\nsetSectionColWidth: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3749 0 return 0;
3750 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3751 0 print STDERR "\nsetSectionColWidth: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3752 0 return 0;
3753 }
3754  
3755 # If -1 is used in the col parameter, use the last col
3756 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
3757  
3758 # You cannot set a nonexistent row
3759 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
3760 0 print STDERR "\n$0:setSectionColWidth: Invalid table reference" ;
3761 0 return 0;
3762 }
3763  
3764 # this sub should change the cell width of a col;
3765 0 my $i;
3766 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
3767 0 $self->setSectionCellWidth($section, $section_num, $i, $col, $value);
3768 }
3769 }
3770  
3771 #-------------------------------------------------------
3772 # Subroutine: setColWidth(col_num, [pixels|percentoftable])
3773 # Author: Anthony Peacock
3774 # Date: 22 Feb 2001
3775 # Modified: 12 Sept 2007 - Anthony Peacock
3776 #-------------------------------------------------------
3777 0 ▶sub setColWidth {
Subroutine setColWidth: not called CC=2 SCAR=17.9
Pod documented
3778 0 my $self = shift;
3779 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3780 0 my $value = shift;
3781  
3782 0 $self->setSectionColWidth('tbody', 0, $col, $value);
3783 }
3784  
3785 #-------------------------------------------------------
3786 # Subroutine: setSectionColHeight('section', section_num, col_num, [pixels])
3787 # Author: Anthony Peacock
3788 # Date: 12 Sept 2007
3789 # Based on: setColHeight
3790 #-------------------------------------------------------
3791 0 ▶sub setSectionColHeight {
Subroutine setSectionColHeight: not called CC=9 SCAR=45.0
Pod documented
3792 0 my $self = shift;
3793 0 my $section = shift;
3794 0 my $section_num = shift;
3795 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3796 0 my $value = shift;
3797
3798 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3799 0 print STDERR "\nsetSectionColHeight: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3800 0 return 0;
3801 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3802 0 print STDERR "\nsetSectionColHeight: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3803 0 return 0;
3804 }
3805
3806 # If -1 is used in the col parameter, use the last col
3807 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
3808  
3809 # You cannot set a nonexistent row
3810 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
3811 0 print STDERR "\n$0:setSectionColHeight: Invalid table reference" ;
3812 0 return 0;
3813 }
3814  
3815 # this sub should change the cell height of a col;
3816 0 my $i;
3817 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
3818 0 $self->setSectionCellHeight($section, $section_num, $i, $col, $value);
3819 }
3820 }
3821  
3822 #-------------------------------------------------------
3823 # Subroutine: setColHeight(col_num, [pixels])
3824 # Author: Anthony Peacock
3825 # Date: 22 Feb 2001
3826 # Modified: 12 Sept 2007 - Anthony Peacock
3827 #-------------------------------------------------------
3828 0 ▶sub setColHeight {
Subroutine setColHeight: not called CC=2 SCAR=17.9
Pod documented
3829 0 my $self = shift;
3830 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3831 0 my $value = shift;
3832  
3833 0 $self->setSectionColHeight('tbody', 0, $col, $value);
3834 }
3835  
3836 #-------------------------------------------------------
3837 # Subroutine: setSectionColBGColor('section', section_num, col_num, [colorname|colortriplet])
3838 # Author: Anthony Peacock
3839 # Date: 12 Sept 2007
3840 # Based on: setColBGColor
3841 #-------------------------------------------------------
3842 0 ▶sub setSectionColBGColor{
Subroutine setSectionColBGColor: not called CC=10 SCAR=47.0
Pod documented
3843 0 my $self = shift;
3844 0 my $section = shift;
3845 0 my $section_num = shift;
3846 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3847 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3848
3849 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3850 0 print STDERR "\nsetSectionColBGColor: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3851 0 return 0;
3852 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3853 0 print STDERR "\nsetSectionColBGColor: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3854 0 return 0;
3855 }
3856  
3857 # If -1 is used in the col parameter, use the last col
3858 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
3859  
3860 # You cannot set a nonexistent row
3861 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
3862 0 print STDERR "\n$0:setSectionColBGColor: Invalid table reference" ;
3863 0 return 0;
3864 }
3865  
3866 # this sub should set bgcolor for each
3867 # cell in a col given a col number;
3868 0 my $i;
3869 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
3870 0 $self->setSectionCellBGColor($section, $section_num, $i, $col, $value);
3871 }
3872 }
3873  
3874 #-------------------------------------------------------
3875 # Subroutine: setColBGColor(col_num, [colorname|colortriplet])
3876 # Author: Jay Flaherty
3877 # Date: 16 Nov 1998
3878 # Modified: 12 Sept 2007 - Anthony Peacock
3879 #-------------------------------------------------------
3880 0 ▶sub setColBGColor{
Subroutine setColBGColor: not called CC=3 SCAR=24.8
Pod documented
3881 0 my $self = shift;
3882 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3883 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3884  
3885 0 $self->setSectionColBGColor( 'tbody', 0, $col, $value);
3886 }
3887  
3888 #-------------------------------------------------------
3889 # Subroutine: setSectionColStyle('section', section_num, col_num, "style")
3890 # Author: Anthony Peacock
3891 # Date: 12 Sept 2007
3892 # Based on: setColStyle
3893 #-------------------------------------------------------
3894 0 ▶sub setSectionColStyle{
Subroutine setSectionColStyle: not called CC=10 SCAR=47.0
Pod documented
3895 0 my $self = shift;
3896 0 my $section = shift;
3897 0 my $section_num = shift;
3898 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3899 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3900
3901 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3902 0 print STDERR "\nsetSectionColStyle: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3903 0 return 0;
3904 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3905 0 print STDERR "\nsetSectionColStyle: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3906 0 return 0;
3907 }
3908  
3909 # If -1 is used in the col parameter, use the last col
3910 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
3911  
3912 # You cannot set a nonexistent row
3913 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
3914 0 print STDERR "\n$0:setSectionColStyle: Invalid table reference" ;
3915 0 return 0;
3916 }
3917  
3918 # this sub should set style for each
3919 # cell in a col given a col number;
3920 0 my $i;
3921 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
3922 0 $self->setSectionCellStyle($section, $section_num, $i,$col, $value);
3923 }
3924 }
3925  
3926 #-------------------------------------------------------
3927 # Subroutine: setColStyle(col_num, "style")
3928 # Author: Anthony Peacock
3929 # Date: 10 Jan 2002
3930 # Modified: 12 Sept 2007 - Anthony Peacock
3931 #-------------------------------------------------------
3932 0 ▶sub setColStyle{
Subroutine setColStyle: not called CC=3 SCAR=24.8
Pod documented
3933 0 my $self = shift;
3934 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3935 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3936  
3937 0 $self->setSectionColStyle( 'tbody', 0, $col, $value);
3938 }
3939  
3940 #-------------------------------------------------------
3941 # Subroutine: setSectionColClass('section', section_num, col_num, 'class')
3942 # Author: Anthony Peacock
3943 # Date: 12 Sept 2007
3944 # Based on: setColClass
3945 #-------------------------------------------------------
3946 0 ▶sub setSectionColClass{
Subroutine setSectionColClass: not called CC=10 SCAR=47.0
Pod documented
3947 0 my $self = shift;
3948 0 my $section = shift;
3949 0 my $section_num = shift;
3950 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3951 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3952
3953 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
3954 0 print STDERR "\nsetSectionColClass: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
3955 0 return 0;
3956 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
3957 0 print STDERR "\nsetSectionColClass: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
3958 0 return 0;
3959 }
3960  
3961 # If -1 is used in the col parameter, use the last col
3962 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
3963  
3964 # You cannot set a nonexistent row
3965 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
3966 0 print STDERR "\n$0:setSectionColClass: Invalid table reference" ;
3967 0 return 0;
3968 }
3969  
3970 # this sub should set class for each
3971 # cell in a col given a col number;
3972 0 my $i;
3973 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
3974 0 $self->setSectionCellClass($section, $section_num, $i,$col, $value);
3975 }
3976 }
3977  
3978 #-------------------------------------------------------
3979 # Subroutine: setColClass(col_num, 'class')
3980 # Author: Anthony Peacock
3981 # Date: 22 July 2002
3982 # Modified: 12 Sept 2007 - Anthony Peacock
3983 #-------------------------------------------------------
3984 0 ▶sub setColClass{
Subroutine setColClass: not called CC=3 SCAR=24.8
Pod documented
3985 0 my $self = shift;
3986 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
3987 0 ▶ my $value = shift || 1;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
3988  
3989 0 $self->setSectionColClass( 'tbody', 0, $col, $value);
3990 }
3991  
3992 #-------------------------------------------------------
3993 # Subroutine: setSectionColFormat('section', section_num, row_num, start_string, end_string)
3994 # Author: Anthony Peacock
3995 # Date: 12 Sept 2007
3996 # Based on: setColFormat
3997 #-------------------------------------------------------
3998 0 ▶sub setSectionColFormat{
Subroutine setSectionColFormat: not called CC=9 SCAR=45.0
Pod documented
3999 0 my $self = shift;
4000 0 my $section = shift;
4001 0 my $section_num = shift;
4002 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
4003 0 my ($start_string, $end_string) = @_;
4004
4005 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
4006 0 print STDERR "\nsetSectionColFormat: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
4007 0 return 0;
4008 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
4009 0 print STDERR "\nsetSectionColFormat: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
4010 0 return 0;
4011 }
4012
4013 # If -1 is used in the col parameter, use the last col
4014 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
4015  
4016 # You cannot set a nonexistent row
4017 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
4018 0 print STDERR "\n$0:setSectionColFormat: Invalid table reference" ;
4019 0 return 0;
4020 }
4021  
4022 # this sub should set format strings for each
4023 # cell in a col given a col number;
4024 0 my $i;
4025 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
4026 0 $self->setSectionCellFormat($section, $section_num, $i,$col, $start_string, $end_string);
4027 }
4028 }
4029  
4030 #-------------------------------------------------------
4031 # Subroutine: setColFormat(row_num, start_string, end_string)
4032 # Author: Anthony Peacock
4033 # Date: 21 Feb 2001
4034 # Modified: 12 Sept 2007
4035 #-------------------------------------------------------
4036 0 ▶sub setColFormat{
Subroutine setColFormat: not called CC=2 SCAR=17.9
Pod documented
4037 0 my $self = shift;
4038 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
4039 0 my ($start_string, $end_string) = @_;
4040  
4041 0 $self->setSectionColFormat( 'tbody', 0, $col, $start_string, $end_string);
4042 }
4043  
4044 #-------------------------------------------------------
4045 # Subroutine: setSectionColAttr('section', section_num, col, "Attribute string")
4046 # Author: Anthony Peacock
4047 # Date: 12 Sept 2007
4048 # Based on: setColAttr
4049 #-------------------------------------------------------
4050 0 ▶sub setSectionColAttr {
Subroutine setSectionColAttr: not called CC=9 SCAR=45.0
Pod documented
4051 0 my $self = shift;
4052 0 my $section = shift;
4053 0 my $section_num = shift;
4054 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
4055 0 my $html_str = shift;
4056
4057 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
4058 0 print STDERR "\nsetSectionColAttr: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
4059 0 return 0;
4060 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
4061 0 print STDERR "\nsetSectionColAttr: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
4062 0 return 0;
4063 }
4064  
4065 # If -1 is used in the col parameter, use the last col
4066 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
4067  
4068 # You cannot set a nonexistent row
4069 0 ▶ if ( $col > $self->{last_col} || $col < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
4070 0 print STDERR "\n$0:setSectionColAttr: Invalid table reference" ;
4071 0 return 0;
4072 }
4073  
4074 # this sub should set attribute string for each
4075 # cell in a col given a col number;
4076 0 my $i;
4077 0 ▶ for ($i=1;$i <= $self->{$section}[$section_num]->{last_row};$i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"}) 0 0 0
4078 0 $self->setSectionCellAttr($section, $section_num, $i,$col, $html_str);
4079 }
4080 }
4081  
4082 #-------------------------------------------------------
4083 # Subroutine: setColAttr(col, "Attribute string")
4084 # Author: Benjamin Longuet
4085 # Date: 27 Feb 2002
4086 # Modified: 12 Sept 2007 - Anthony Peacock
4087 #-------------------------------------------------------
4088 0 ▶sub setColAttr {
Subroutine setColAttr: not called CC=2 SCAR=17.9
Pod documented
4089 0 my $self = shift;
4090 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
4091 0 my $html_str = shift;
4092  
4093 0 $self->setSectionColAttr( 'tbody', 0,$col, $html_str);
4094 }
4095  
4096 #-------------------------------------------------------
4097 # Subroutine: getSectionColStyle('section', section_num, $col_num)
4098 # Author: Anthony Peacock
4099 # Date: 12 Sept 2007
4100 # Description: getter for col style
4101 # Based on: getColStyle
4102 #-------------------------------------------------------
4103 0 ▶sub getSectionColStyle {
Subroutine getSectionColStyle: not called CC=5 SCAR=34.0
Pod documented
4104 0 my ($self, $section, $section_num, $col) = @_;
4105
4106 0 ▶ if ( $section !~ /thead|tbody|tfoot/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $section =~ /thead|tbody|tfoot/i) { } 0 0 0
elsif ($section =~ /thead|tfoot/i and $section_num > 0) { } 0 0 0
4107 0 print STDERR "\ngetSectionColStyle: Section can be : 'thead | tbody | tfoot' : Cur value: $section\n";
4108 0 return 0;
4109 ▶ } elsif ( $section =~ /thead|tfoot/i && $section_num > 0 ) {
Condition0%0/3
$section =~ /thead|tfoot/i and $section_num > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$section =~ /thead|tfoot/i and $section_num > 0
$section =~ /thead|tfoot/i $section_num > 0
Truth table0%0/3
A and B
A= $section =~ /thead|tfoot/iB= $section_num > 0
ABresult
0X0
100
111
4110 0 print STDERR "\ngetSectionColStyle: Section number for Head and Foot can only be 0 : Cur value: $section_num\n";
4111 0 return 0;
4112 }
4113  
4114 0 ▶ if ($self->_checkRowAndCol('getSectionColStyle', $section, $section_num, {col => $col})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_checkRowAndCol('getSectionColStyle', $section, $section_num, {'col', $col})) { } 0 0 0
4115 0 my $last_row = $self->{$section}[$section_num]->{last_row};
4116 0 return $self->{$section}[$section_num]->{rows}->[$last_row]->{cells}[$col]->{style};
4117 }
4118 else {
4119 0 return undef;
4120 }
4121 }
4122  
4123 #-------------------------------------------------------
4124 # Subroutine: getColStyle($col_num)
4125 # Author: Douglas Riordan
4126 # Date: 1 Dec 2005
4127 # Description: getter for col style
4128 # Modified: 12 Sept 2007 - Anthony Peacock
4129 #-------------------------------------------------------
4130 0 ▶sub getColStyle {
Subroutine getColStyle: not called CC=1 SCAR=6.9
Pod documented
4131 0 my ($self, $col) = @_;
4132  
4133 0 return $self->getSectionColStyle ( 'tbody', 0, $col );
4134 }
4135  
4136 #-------------------------------------------------------
4137 #*******************************************************
4138 #
4139 # End of public methods
4140 #
4141 # The following methods are internal to this package
4142 #
4143 #*******************************************************
4144 #-------------------------------------------------------
4145  
4146 #-------------------------------------------------------
4147 # Subroutine: _updateSpanGrid('section', section_num, row_num, col_num)
4148 # Author: Stacy Lacy
4149 # Date: 31 Jul 1997
4150 # Modified: 23 Oct 2003 - Anthony Peacock (Version 2 new data structure)
4151 #-------------------------------------------------------
4152 0 ▶sub _updateSpanGrid {
Subroutine _updateSpanGrid: not called CC=20 SCAR=60.4
4153 0 my $self = shift;
4154 0 my $section = shift;
4155 0 my $section_num = shift;
4156 0 ▶ (my $row = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $row = shift() or return 0 0 0 0
4157 0 ▶ (my $col = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $col = shift() or return 0 0 0 0
4158  
4159 0 ▶ my $colspan = $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{colspan} || 0;
Condition0%0/2
$self->{$section}[$section_num]{'rows'}[$row]{'cells'}[$col]{'colspan'} || 0
l!l
00
MC/DC0%0/1
$self->{$section}[$section_num]{'rows'}[$row]{'cells'}[$col]{'colspan'} || 0
$self->{$section}[$section_num]{'rows'}[$row]{'cells'}[$col]{'colspan'}
Truth table0%0/2
A
A= $self->{$section}[$section_num]{'rows'}[$row]{'cells'}[$col]{'colspan'}
Aresult
11
00
4160 0 ▶ my $rowspan = $self->{$section}[$section_num]->{rows}[$row]->{cells}[$col]->{rowspan} || 0;
Condition0%0/2
$self->{$section}[$section_num]{'rows'}[$row]{'cells'}[$col]{'rowspan'} || 0
l!l
00
MC/DC0%0/1
$self->{$section}[$section_num]{'rows'}[$row]{'cells'}[$col]{'rowspan'} || 0
$self->{$section}[$section_num]{'rows'}[$row]{'cells'}[$col]{'rowspan'}
Truth table0%0/2
A
A= $self->{$section}[$section_num]{'rows'}[$row]{'cells'}[$col]{'rowspan'}
Aresult
11
00
4161  
4162 0 ▶ if ($self->{autogrow}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"autogrow"}) 0 0 0
4163 0 ▶ $self->{last_col} = $col + $colspan - 1 unless $self->{last_col} > ($col + $colspan - 1 );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"last_col"} > $col + $colspan - 1 0 0 0
4164 0 ▶ $self->{$section}[$section_num]->{last_row} = $row + $rowspan - 1 unless $self->{$section}[$section_num]->{last_row} > ($row + $rowspan - 1 );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{$section}[$section_num]{"last_row"} > $row + $rowspan - 1 0 0 0
4165 }
4166  
4167 0 my ($i, $j);
4168 0 ▶ if ($colspan) {
Branch: 1 branch
BranchTrueFalseTotal
if ($colspan) 0 0 0
4169 0 ▶ for ($j=$col+1;(($j <= $self->{last_col}) && ($j <= ($col +$colspan -1))); $j++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j <= $self->{"last_col"} and $j <= $col + $colspan - 1) 0 0 0
Condition0%0/3
$j <= $self->{"last_col"} and $j <= $col + $colspan - 1
!ll&&!rl&&r
000
MC/DC0%0/2
$j <= $self->{"last_col"} and $j <= $col + $colspan - 1
$j <= $self->{"last_col"} $j <= $col + $colspan - 1
Truth table0%0/3
A and B
A= $j <= $self->{"last_col"}B= $j <= $col + $colspan - 1
ABresult
0X0
100
111
4170 0 $self->{$section}[$section_num]->{rows}[$row]->{cells}[$j]->{colspan} = "SPANNED";
4171 }
4172 }
4173 0 ▶ if ($rowspan) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rowspan) 0 0 0
4174 0 ▶ for ($i=$row+1;(($i <= $self->{$section}[$section_num]->{last_row}) && ($i <= ($row +$rowspan -1))); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"} and $i <= $row + $rowspan - 1) 0 0 0
Condition0%0/3
$i <= $self->{$section}[$section_num]{"last_row"} and $i <= $row + $rowspan - 1
!ll&&!rl&&r
000
MC/DC0%0/2
$i <= $self->{$section}[$section_num]{"last_row"} and $i <= $row + $rowspan - 1
$i <= $self->{$section}[$section_num]{"last_row"} $i <= $row + $rowspan - 1
Truth table0%0/3
A and B
A= $i <= $self->{$section}[$section_num]{"last_row"}B= $i <= $row + $rowspan - 1
ABresult
0X0
100
111
4175 0 $self->{$section}[$section_num]->{rows}[$i]->{cells}[$col]->{colspan} = "SPANNED";
4176 }
4177 }
4178  
4179 0 ▶ if ($colspan && $rowspan) {
Branch: 1 branch
BranchTrueFalseTotal
if ($colspan and $rowspan) 0 0 0
Condition0%0/3
$colspan and $rowspan
!ll&&!rl&&r
000
MC/DC0%0/2
$colspan and $rowspan
$colspan $rowspan
Truth table0%0/3
A and B
A= $colspanB= $rowspan
ABresult
0X0
100
111
4180 # Spanned Grid
4181 0 ▶ for ($i=$row+1;(($i <= $self->{$section}[$section_num]->{last_row}) && ($i <= ($row +$rowspan -1))); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{$section}[$section_num]{"last_row"} and $i <= $row + $rowspan - 1) 0 0 0
Condition0%0/3
$i <= $self->{$section}[$section_num]{"last_row"} and $i <= $row + $rowspan - 1
!ll&&!rl&&r
000
MC/DC0%0/2
$i <= $self->{$section}[$section_num]{"last_row"} and $i <= $row + $rowspan - 1
$i <= $self->{$section}[$section_num]{"last_row"} $i <= $row + $rowspan - 1
Truth table0%0/3
A and B
A= $i <= $self->{$section}[$section_num]{"last_row"}B= $i <= $row + $rowspan - 1
ABresult
0X0
100
111
4182 0 ▶ for ($j=$col+1;(($j <= $self->{last_col}) && ($j <= ($col +$colspan -1))); $j++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j <= $self->{"last_col"} and $j <= $col + $colspan - 1) 0 0 0
Condition0%0/3
$j <= $self->{"last_col"} and $j <= $col + $colspan - 1
!ll&&!rl&&r
000
MC/DC0%0/2
$j <= $self->{"last_col"} and $j <= $col + $colspan - 1
$j <= $self->{"last_col"} $j <= $col + $colspan - 1
Truth table0%0/3
A and B
A= $j <= $self->{"last_col"}B= $j <= $col + $colspan - 1
ABresult
0X0
100
111
4183 0 $self->{$section}[$section_num]->{rows}[$i]->{cells}[$j]->{colspan} = "SPANNED";
4184 }
4185 }
4186 }
4187 }
4188  
4189 #-------------------------------------------------------
4190 # Subroutine: _getTableHashValues(tablehashname)
4191 # Author: Stacy Lacy
4192 # Date: 31 Jul 1997
4193 #-------------------------------------------------------
4194 0 ▶sub _getTableHashValues {
Subroutine _getTableHashValues: not called CC=4 SCAR=30.0
4195 0 my $self = shift;
4196 0 ▶ (my $hashname = shift) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $hashname = shift() or return 0 0 0 0
4197  
4198 0 my ($i, $j, $retval);
4199 0 ▶ for ($i=1; $i <= ($self->{last_row}); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $self->{"last_row"}) 0 0 0
4200 0 ▶ for ($j=1; $j <= ($self->{last_col}); $j++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j <= $self->{"last_col"}) 0 0 0
4201 0 $retval.= "|$i:$j| " . ($self->{"$hashname"}{"$i:$j"}) . " ";
4202 }
4203 0 $retval.=" |<br />";
4204 }
4205  
4206 0 return $retval;
4207 }
4208  
4209 #-------------------------------------------------------
4210 # Subroutine: _is_validnum(string_value)
4211 # Author: Anthony Peacock
4212 # Date: 12 Jul 2000
4213 # Description: Checks the string value passed as a parameter
4214 # and returns true if it is >= 0
4215 # Modified: 23 Oct 2001 - Terence Brown
4216 # Modified: 30 Aug 2002 - Tommi Maekitalo
4217 #-------------------------------------------------------
4218 0 ▶sub _is_validnum {
Subroutine _is_validnum: not called CC=4 SCAR=30.0
4219 0 my $str = shift;
4220  
4221 0 ▶ if ( defined($str) && $str =~ /^\s*\d+\s*$/ && $str >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $str and $str =~ /^\s*\d+\s*$/ and $str >= 0) { } 0 0 0
Condition0%0/6
defined $str and $str =~ /^\s*\d+\s*$/ and $str >= 0
!ll&&!rl&&r
000
defined $str and $str =~ /^\s*\d+\s*$/
!ll&&!rl&&r
000
MC/DC0%0/3
defined $str and $str =~ /^\s*\d+\s*$/ and $str >= 0
defined $str $str =~ /^\s*\d+\s*$/ $str >= 0
Truth table0%0/4
A and B and C
A= defined $strB= $str =~ /^\s*\d+\s*$/C= $str >= 0
ABCresult
0XX0
10X0
1100
1111
4222 0 return 1;
4223 } else {
4224 0 return;
4225 }
4226 }
4227  
4228 #----------------------------------------------------------------------
4229 # Subroutine: _install_stateful_set_method
4230 # Author: Paul Vernaza
4231 # Date: 1 July 2002
4232 # Description: Generates and installs a stateful version of the given
4233 # setter method (in the sense that it 'remembers' the last row or
4234 # column in the table and passes it as an implicit argument).
4235 #----------------------------------------------------------------------
4236 0 ▶sub _install_stateful_set_method {
Subroutine _install_stateful_set_method: not called CC=4 SCAR=25.0
4237 0 my ($called_method, $real_method) = @_;
4238  
4239 0 ▶ my $row_andor_cell = $real_method =~ /^setCell/ ?
Branch: 3 branches
BranchTrueFalseTotal
$real_method =~ /^setCell/ ? : 0 0 0
$real_method =~ /^setRow/ ? : 0 0 0
$real_method =~ /^setCol/ ? : 0 0 0
4240 '($self->getTableRows, $self->getTableCols)' :
4241 $real_method =~ /^setRow/ ? '$self->getTableRows' :
4242 $real_method =~ /^setCol/ ? '$self->getTableCols' :
4243 die 'can\'t determine argument type(s)';
4244
4245 0 ▶ { no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.2
4246 0 ▶ *$called_method = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
4247 0 my $self = shift();
4248 0 return &$real_method($self, eval ($row_andor_cell), @_);
4249 0 }; }
4250 }
4251  
4252 #----------------------------------------------------------------------
4253 # Subroutine: AUTOLOAD
4254 # Author: Paul Vernaza
4255 # Date: 1 July 2002
4256 # Description: Intercepts calls to setLast* methods, generates them
4257 # if possible from existing set-methods that require explicit row/column.
4258 # Modified: 23 January 2006 - Suggestion by Gordon Lack
4259 # Modified: 1 February 2006 - Made the "Usupported method" code more flexible.
4260 #----------------------------------------------------------------------
4261  
4262 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=3 SCAR=24.8
4263 0 (my $called_method = $AUTOLOAD ) =~ s/.*:://;
4264 0 (my $real_method = $called_method) =~ s/^setLast/set/;
4265  
4266 0 ▶ return if ($called_method eq 'DESTROY');
Branch: 1 branch
BranchTrueFalseTotal
if $called_method eq "DESTROY" 0 0 0
4267  
4268 0 ▶ die sprintf("Unsupported method $called_method call in %s\n", __PACKAGE__) unless defined(&$real_method);
Branch: 1 branch
BranchTrueFalseTotal
unless defined &$real_method 0 0 0
4269  
4270 0 _install_stateful_set_method($called_method, $real_method);
4271 0 goto &$called_method;
4272 }
4273  
4274  
4275 #----------------------------------------------------------------------
4276 # Subroutine: _checkRowAndCol($caller_method, $hsh_ref)
4277 # Author: Douglas Riordan
4278 # Date: 30 Nov 2005
4279 # Description: validates row and col coordinates
4280 # Modified: 12 Sept 2007 - Anthony Peacock
4281 #----------------------------------------------------------------------
4282 0 ▶sub _checkRowAndCol {
Subroutine _checkRowAndCol: not called CC=9 SCAR=45.0
4283 0 my ($self, $method, $section, $section_num, $attrs) = @_;
4284  
4285 0 ▶ if (defined $attrs->{row}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $attrs->{"row"}) 0 0 0
4286 0 my $row = $attrs->{row};
4287 # if -1 is used in the row parameter, use the last row
4288 0 ▶ $row = $self->{$section}[$section_num]->{last_row} if $row == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $row == -1 0 0 0
4289 0 ▶ if ($row > $self->{$section}[$section_num]->{last_row} || $row < 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row > $self->{$section}[$section_num]{"last_row"} or $row < 1) 0 0 0
Condition0%0/3
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$row > $self->{$section}[$section_num]{"last_row"} or $row < 1
$row > $self->{$section}[$section_num]{"last_row"} $row < 1
Truth table0%0/3
A or B
A= $row > $self->{$section}[$section_num]{"last_row"}B= $row < 1
ABresult
1X1
011
000
4290 0 print STDERR "$0: $method - Invalid table row reference\n";
4291 0 return 0;
4292 }
4293 }
4294  
4295 0 ▶ if (defined $attrs->{col}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $attrs->{"col"}) 0 0 0
4296 0 my $col = $attrs->{col};
4297 # if -1 is used in the col parameter, use the last col
4298 0 ▶ $col = $self->{last_col} if $col == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $col == -1 0 0 0
4299 0 ▶ if ($col > $self->{last_col} || $col < 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($col > $self->{"last_col"} or $col < 1) 0 0 0
Condition0%0/3
$col > $self->{"last_col"} or $col < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$col > $self->{"last_col"} or $col < 1
$col > $self->{"last_col"} $col < 1
Truth table0%0/3
A or B
A= $col > $self->{"last_col"}B= $col < 1
ABresult
1X1
011
000
4300 0 print STDERR "$0: $method - Invalid table col reference\n";
4301 0 return 0;
4302 }
4303 }
4304  
4305 0 return 1;
4306 }
4307  
4308 1 1;
4309  
4310 __END__
↑ Summary