Porf/Table/Simple.pm

filter: Statementstmt 72.4% 313 / 432 Branchbran 47.4% 55 / 116 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 87.2% 96 / 110 Podpod 0.0% 0 / 104 totaltotal 60.6% 465 / 767 CC 61 SCAR 7.9
CC
61
Cov
67%
interprete_file_parameter
6.1
is_format
6.0
set_cell_output_action
6.0
CRAP 2.2
« Porf/rename_subs.pl ↑ Summary Porf/examples/Person.pm »
1 # perl
2 #
3 # Class Report::Porf::Table::Simple
4 #
5 # Use Configurator or Framework of namespace Report::Porf to create Instances,
6 # that export data as text, html, csv, LaTeX, for wikis and Excel
7 #
8 # Ralf Peine, Wed May 14 10:39:51 2014
9 #
10 # More documentation at the end of file
11 #------------------------------------------------------------------------------
12
13 1 $VERSION = "2.001";
14
15 #------------------------------------------------------------------------------
16 #
17 # Easy create lists like this as text, html, csv, ...:
18 #
19 # *============+======================+=========+=======+======================*
20 # @ Count @ Prename @ Surname @ Age @ TimeStamp @
21 # *------------+----------------------+---------+-------+----------------------*
22 # | 1 | Vorname 1 | Name 1 | 10 | 0.002329 |
23 # | 2 | Vorname 2 | Name 2 | 20 | 0.003106 |
24 # | 3 | Vorname 3 | Name 3 | 30 | 0.003822 |
25 # | 4 | Vorname 4 | Name 4 | 40 | 0.004533 |
26 # | 5 | Vorname 5 | Name 5 | 50 | 0.005235 |
27 # | 6 | Vorname 6 | Name 6 | 60 | 0.005944 |
28 # | 7 | Vorname 7 | Name 7 | 70 | 0.006656 |
29 # | 8 | Vorname 8 | Name 8 | 80 | 0.007362 |
30 # | 9 | Vorname 9 | Name 9 | 90 | 0.008069 |
31 # | 10 | Vorname 10 | Name 10 | 100 | 0.008779 |
32 # *============+======================+=========+=======+======================*
33 #
34 # # Time needed for export of 10 data lines: 0.001954
35 #
36 #------------------------------------------------------------------------------
37
38 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
40
41 #--------------------------------------------------------------------------------
42 #
43 # Report::Porf::Table::Simple;
44 #
45 #--------------------------------------------------------------------------------
46
47 package Report::Porf::Table::Simple;
48
49 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
50 1 ▶use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
51
52 1 ▶use Report::Porf::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
53
54 #--------------------------------------------------------------------------------
55 #
56 # Creation / Filling Of Instances
57 #
58 #--------------------------------------------------------------------------------
59
60 # --- create Instance -----------------
61 sub new
62 19 ▶{
Subroutine new: called CC=2 SCAR=7.1
Pod undocumented
63 19 my $caller = $_[0];
64 19 ▶ my $class = ref($caller) || $caller;
Condition33%1/3
ref $caller || $caller
l!l&&r!l&&!r
0190
MC/DC0%0/2
ref $caller || $caller
ref $caller $caller
Truth table33%1/3
A || B
A= ref $callerB= $caller
ABresult
1X1
011
000
65
66 # let the class go
67 19 my $self = {};
68 19 bless $self, $class;
69
70 19 $self->_init();
71
72 19 return $self;
73 }
74
75 # --- initialise instance -------------
76 19 ▶sub _init {
Subroutine _init: called CC=1 SCAR=0.0
77 19 my ($self, # instance_ref
78 ) = @_;
79
80 19 $self->set_default_column_width (0);
81 19 $self->set_max_col_width (0);
82 19 $self->set_max_column_idx (-2);
83 19 $self->set_format ('?');
84
85 19 $self->set_column_widths_ref([]);
86 19 $self->set_header_texts_ref ([]);
87
88 19 $self->set_file_start ('');
89 19 $self->set_page_start ('');
90 19 $self->set_table_start ('');
91
92 19 $self->set_header_row_start ('');
93 19 $self->set_header_start ('');
94 19 $self->set_header_end ('');
95 19 $self->set_header_row_end ('');
96
97 19 $self->set_row_start ('');
98 19 $self->set_cell_start ('');
99 19 $self->set_cell_end ('');
100 19 $self->set_row_end ('');
101
102 19 $self->set_table_end ('');
103 19 $self->set_page_end ('');
104 19 $self->set_file_end ('');
105
106 19 $self->set_default_align ('');
107
108 19 $self->set_header_line ('');
109 19 $self->set_separator_line ('');
110 19 $self->set_bold_header_line ('');
111
112 19 $self->set_bold ('');
113 19 $self->set_italics ('');
114 19 $self->set_left ('');
115 19 $self->set_right ('');
116 19 $self->set_center ('');
117
118 19 $self->set_horizontal_separation_start ('');
119 19 $self->set_horizontal_separation_end ('');
120 19 $self->set_horizontal_separation_column_separator ('');
121 19 $self->set_horizontal_separation_char ('');
122 19 $self->set_horizontal_separation_bold_char ('');
123
124 # $self->set_configure_column_action (sub {});
125 # $self->set_configure_complete_action (sub {});
126 # $self->set_cell_output_action (sub {});
127 # $self->set_header_output_action (sub {});
128 # $self->set_row_output_action (sub {});
129 # $self->set_start_table_output_action (sub {});
130 # $self->set_end_table_output_action (sub {});
131 # $self->set_row_group_changes_action (sub {});
132
133 19 $self->set_verbose (0);
134
135 19 my @CellOutputActions;
136 19 $self->{CellOutputActions} = \@CellOutputActions;
137 }
138
139 #--------------------------------------------------------------------------------
140 #
141 # Attributes
142 #
143 #--------------------------------------------------------------------------------
144
145 # Generated by peiner from CreateGetSetter.pl at Fri Apr 19 08:27:27 2013
146
147 # --- Format ---------------------------------------------------------------
148
149 33 ▶sub set_format {
Subroutine set_format: called CC=2 SCAR=8.4
Pod undocumented
150 33 my ($self, # instance_ref
151 $value # value to set
152 ) = @_;
153
154 33 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 33 33
155 0 warn ("Cannot set Format after configuration has been completed in ".(caller(3))[3]."\n");
156 0 return;
157 }
158
159 33 $self->{Format} = $value;
160 }
161
162 0 ▶sub get_format {
Subroutine get_format: not called CC=1 SCAR=6.9
Pod undocumented
163 0 my ($self, # instance_ref
164 ) = @_;
165
166 0 return $self->{Format};
167 }
168
169 # --- Check, if given format is used for export ---
170 0 ▶sub is_format {
Subroutine is_format: not called CC=2 SCAR=17.9
Pod undocumented
171 0 my ($self, # instance_ref
172 $format # format to compare with
173 ) = @_;
174
175 0 ▶ return lc ($self->{Format}) eq lc($format) ? 1: 0;
Branch: 1 branch
BranchTrueFalseTotal
lc $self->{'Format'} eq lc $format ? : 0 0 0
176 }
177
178 # --- MaxColWidth ---------------------------------------------------------------
179
180 19 ▶sub set_max_col_width {
Subroutine set_max_col_width: called CC=2 SCAR=8.4
Pod undocumented
181 19 my ($self, # instance_ref
182 $value # value to set
183 ) = @_;
184
185 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
186 0 warn ("Cannot set MaxColWidth after configuration has been completed in ".(caller(3))[3]."\n");
187 0 return;
188 }
189
190 19 $self->{MaxColWidth} = $value;
191 }
192
193 1 ▶sub get_max_col_width {
Subroutine get_max_col_width: called CC=1 SCAR=0.0
Pod undocumented
194 1 my ($self, # instance_ref
195 ) = @_;
196
197 1 return $self->{MaxColWidth};
198 }
199
200 # --- DefaultColumnWidth ---------------------------------------------------------------
201
202 29 ▶sub set_default_column_width {
Subroutine set_default_column_width: called CC=2 SCAR=8.4
Pod undocumented
203 29 my ($self, # instance_ref
204 $value # value to set
205 ) = @_;
206
207 29 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 29 29
208 0 warn ("Cannot set DefaultColumnWidth after configuration has been completed in ".(caller(3))[3]."\n");
209 0 return;
210 }
211
212 29 $self->{DefaultColumnWidth} = $value;
213 }
214
215 2 ▶sub get_default_column_width {
Subroutine get_default_column_width: called CC=1 SCAR=0.0
Pod undocumented
216 2 my ($self, # instance_ref
217 ) = @_;
218
219 2 return $self->{DefaultColumnWidth};
220 }
221
222 # --- DefaultAlign ---------------------------------------------------------------
223
224 36 ▶sub set_default_align {
Subroutine set_default_align: called CC=2 SCAR=8.4
Pod undocumented
225 36 my ($self, # instance_ref
226 $value # value to set
227 ) = @_;
228
229 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
230 0 warn ("Cannot set DefaultAlign after configuration has been completed in ".(caller(3))[3]."\n");
231 0 return;
232 }
233
234 36 $self->{DefaultAlign} = $value;
235 }
236
237 3 ▶sub get_default_align {
Subroutine get_default_align: called CC=1 SCAR=0.0
Pod undocumented
238 3 my ($self, # instance_ref
239 ) = @_;
240
241 3 return $self->{DefaultAlign};
242 }
243
244 # --- MaxColumnIdx ---------------------------------------------------------------
245
246 19 ▶sub set_max_column_idx {
Subroutine set_max_column_idx: called CC=2 SCAR=8.4
Pod undocumented
247 19 my ($self, # instance_ref
248 $value # value to set
249 ) = @_;
250
251 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
252 0 warn ("Cannot set MaxColumnIdx after configuration has been completed in ".(caller(3))[3]."\n");
253 0 return;
254 }
255
256 19 $self->{MaxColumnIdx} = $value;
257 }
258
259 1 ▶sub get_max_column_idx {
Subroutine get_max_column_idx: called CC=1 SCAR=0.0
Pod undocumented
260 1 my ($self, # instance_ref
261 ) = @_;
262
263 1 return $self->{MaxColumnIdx};
264 }
265
266 # --- ColumnWidthsRef ---------------------------------------------------------------
267
268 19 ▶sub set_column_widths_ref {
Subroutine set_column_widths_ref: called CC=2 SCAR=8.4
Pod undocumented
269 19 my ($self, # instance_ref
270 $value # value to set
271 ) = @_;
272
273 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
274 0 warn ("Cannot set ColumnWidthsRef after configuration has been completed in ".(caller(3))[3]."\n");
275 0 return;
276 }
277
278 19 $self->{ColumnWidthsRef} = $value;
279 }
280
281 104 ▶sub get_column_widths_ref {
Subroutine get_column_widths_ref: called CC=1 SCAR=0.0
Pod undocumented
282 104 my ($self, # instance_ref
283 ) = @_;
284
285 104 return $self->{ColumnWidthsRef};
286 }
287
288 # --- HeaderTextsRef ---------------------------------------------------------------
289
290 19 ▶sub set_header_texts_ref {
Subroutine set_header_texts_ref: called CC=2 SCAR=8.4
Pod undocumented
291 19 my ($self, # instance_ref
292 $value # value to set
293 ) = @_;
294
295 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
296 0 warn ("Cannot set HeaderTextsRef after configuration has been completed in ".(caller(3))[3]."\n");
297 0 return;
298 }
299
300 19 $self->{HeaderTextsRef} = $value;
301 }
302
303 93 ▶sub get_header_texts_ref {
Subroutine get_header_texts_ref: called CC=1 SCAR=0.0
Pod undocumented
304 93 my ($self, # instance_ref
305 ) = @_;
306
307 93 return $self->{HeaderTextsRef};
308 }
309
310 # --- FileStart ---------------------------------------------------------------
311
312 36 ▶sub set_file_start {
Subroutine set_file_start: called CC=2 SCAR=8.4
Pod undocumented
313 36 my ($self, # instance_ref
314 $value # value to set
315 ) = @_;
316
317 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
318 0 warn ("Cannot set FileStart after configuration has been completed in ".(caller(3))[3]."\n");
319 0 return;
320 }
321
322 36 $self->{FileStart} = $value;
323 }
324
325 10 ▶sub get_file_start {
Subroutine get_file_start: called CC=1 SCAR=0.0
Pod undocumented
326 10 my ($self, # instance_ref
327 ) = @_;
328
329 10 return $self->{FileStart};
330 }
331
332 # --- FileEnd ---------------------------------------------------------------
333
334 36 ▶sub set_file_end {
Subroutine set_file_end: called CC=2 SCAR=8.4
Pod undocumented
335 36 my ($self, # instance_ref
336 $value # value to set
337 ) = @_;
338
339 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
340 0 warn ("Cannot set FileEnd after configuration has been completed in ".(caller(3))[3]."\n");
341 0 return;
342 }
343
344 36 $self->{FileEnd} = $value;
345 }
346
347 10 ▶sub get_file_end {
Subroutine get_file_end: called CC=1 SCAR=0.0
Pod undocumented
348 10 my ($self, # instance_ref
349 ) = @_;
350
351 10 return $self->{FileEnd};
352 }
353
354 # --- TableStart ---------------------------------------------------------------
355
356 39 ▶sub set_table_start {
Subroutine set_table_start: called CC=2 SCAR=8.4
Pod undocumented
357 39 my ($self, # instance_ref
358 $value # value to set
359 ) = @_;
360
361 39 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 39 39
362 0 warn ("Cannot set TableStart after configuration has been completed in ".(caller(3))[3]."\n");
363 0 return;
364 }
365
366 39 $self->{TableStart} = $value;
367 }
368
369 10 ▶sub get_table_start {
Subroutine get_table_start: called CC=1 SCAR=0.0
Pod undocumented
370 10 my ($self, # instance_ref
371 ) = @_;
372
373 10 return $self->{TableStart};
374 }
375
376 # --- TableEnd ---------------------------------------------------------------
377
378 46 ▶sub set_table_end {
Subroutine set_table_end: called CC=2 SCAR=8.4
Pod undocumented
379 46 my ($self, # instance_ref
380 $value # value to set
381 ) = @_;
382
383 46 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 46 46
384 0 warn ("Cannot set TableEnd after configuration has been completed in ".(caller(3))[3]."\n");
385 0 return;
386 }
387
388 46 $self->{TableEnd} = $value;
389 }
390
391 10 ▶sub get_table_end {
Subroutine get_table_end: called CC=1 SCAR=0.0
Pod undocumented
392 10 my ($self, # instance_ref
393 ) = @_;
394
395 10 return $self->{TableEnd};
396 }
397
398 # --- HeaderRowStart ---------------------------------------------------------------
399
400 36 ▶sub set_header_row_start {
Subroutine set_header_row_start: called CC=2 SCAR=8.4
Pod undocumented
401 36 my ($self, # instance_ref
402 $value # value to set
403 ) = @_;
404
405 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
406 0 warn ("Cannot set HeaderRowStart after configuration has been completed in ".(caller(3))[3]."\n");
407 0 return;
408 }
409
410 36 $self->{HeaderRowStart} = $value;
411 }
412
413 10 ▶sub get_header_row_start {
Subroutine get_header_row_start: called CC=1 SCAR=0.0
Pod undocumented
414 10 my ($self, # instance_ref
415 ) = @_;
416
417 10 return $self->{HeaderRowStart};
418 }
419
420 # --- HeaderRowEnd ---------------------------------------------------------------
421
422 36 ▶sub set_header_row_end {
Subroutine set_header_row_end: called CC=2 SCAR=8.4
Pod undocumented
423 36 my ($self, # instance_ref
424 $value # value to set
425 ) = @_;
426
427 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
428 0 warn ("Cannot set HeaderRowEnd after configuration has been completed in ".(caller(3))[3]."\n");
429 0 return;
430 }
431
432 36 $self->{HeaderRowEnd} = $value;
433 }
434
435 10 ▶sub get_header_row_end {
Subroutine get_header_row_end: called CC=1 SCAR=0.0
Pod undocumented
436 10 my ($self, # instance_ref
437 ) = @_;
438
439 10 return $self->{HeaderRowEnd};
440 }
441
442 # --- PageStart ---------------------------------------------------------------
443
444 19 ▶sub set_page_start {
Subroutine set_page_start: called CC=2 SCAR=8.4
Pod undocumented
445 19 my ($self, # instance_ref
446 $value # value to set
447 ) = @_;
448
449 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
450 0 warn ("Cannot set PageStart after configuration has been completed in ".(caller(3))[3]."\n");
451 0 return;
452 }
453
454 19 $self->{PageStart} = $value;
455 }
456
457 0 ▶sub get_page_start {
Subroutine get_page_start: not called CC=1 SCAR=6.9
Pod undocumented
458 0 my ($self, # instance_ref
459 ) = @_;
460
461 0 return $self->{PageStart};
462 }
463
464 # --- PageEnd ---------------------------------------------------------------
465
466 19 ▶sub set_page_end {
Subroutine set_page_end: called CC=2 SCAR=8.4
Pod undocumented
467 19 my ($self, # instance_ref
468 $value # value to set
469 ) = @_;
470
471 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
472 0 warn ("Cannot set PageEnd after configuration has been completed in ".(caller(3))[3]."\n");
473 0 return;
474 }
475
476 19 $self->{PageEnd} = $value;
477 }
478
479 0 ▶sub get_page_end {
Subroutine get_page_end: not called CC=1 SCAR=6.9
Pod undocumented
480 0 my ($self, # instance_ref
481 ) = @_;
482
483 0 return $self->{PageEnd};
484 }
485
486 # --- RowStart ---------------------------------------------------------------
487
488 36 ▶sub set_row_start {
Subroutine set_row_start: called CC=2 SCAR=8.4
Pod undocumented
489 36 my ($self, # instance_ref
490 $value # value to set
491 ) = @_;
492
493 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
494 0 warn ("Cannot set RowStart after configuration has been completed in ".(caller(3))[3]."\n");
495 0 return;
496 }
497
498 36 $self->{RowStart} = $value;
499 }
500
501 66 ▶sub get_row_start {
Subroutine get_row_start: called CC=1 SCAR=0.0
Pod undocumented
502 66 my ($self, # instance_ref
503 ) = @_;
504
505 66 return $self->{RowStart};
506 }
507
508 # --- RowEnd ---------------------------------------------------------------
509
510 36 ▶sub set_row_end {
Subroutine set_row_end: called CC=2 SCAR=8.4
Pod undocumented
511 36 my ($self, # instance_ref
512 $value # value to set
513 ) = @_;
514
515 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
516 0 warn ("Cannot set RowEnd after configuration has been completed in ".(caller(3))[3]."\n");
517 0 return;
518 }
519
520 36 $self->{RowEnd} = $value;
521 }
522
523 66 ▶sub get_row_end {
Subroutine get_row_end: called CC=1 SCAR=0.0
Pod undocumented
524 66 my ($self, # instance_ref
525 ) = @_;
526
527 66 return $self->{RowEnd};
528 }
529
530 # --- HeaderStart ---------------------------------------------------------------
531
532 36 ▶sub set_header_start {
Subroutine set_header_start: called CC=2 SCAR=8.4
Pod undocumented
533 36 my ($self, # instance_ref
534 $value # value to set
535 ) = @_;
536
537 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
538 0 warn ("Cannot set HeaderStart after configuration has been completed in ".(caller(3))[3]."\n");
539 0 return;
540 }
541
542 36 $self->{HeaderStart} = $value;
543 }
544
545 60 ▶sub get_header_start {
Subroutine get_header_start: called CC=1 SCAR=0.0
Pod undocumented
546 60 my ($self, # instance_ref
547 ) = @_;
548
549 60 return $self->{HeaderStart};
550 }
551
552 # --- HeaderEnd ---------------------------------------------------------------
553
554 36 ▶sub set_header_end {
Subroutine set_header_end: called CC=2 SCAR=8.4
Pod undocumented
555 36 my ($self, # instance_ref
556 $value # value to set
557 ) = @_;
558
559 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
560 0 warn ("Cannot set HeaderEnd after configuration has been completed in ".(caller(3))[3]."\n");
561 0 return;
562 }
563
564 36 $self->{HeaderEnd} = $value;
565 }
566
567 60 ▶sub get_header_end {
Subroutine get_header_end: called CC=1 SCAR=0.0
Pod undocumented
568 60 my ($self, # instance_ref
569 ) = @_;
570
571 60 return $self->{HeaderEnd};
572 }
573
574 # --- CellStart ---------------------------------------------------------------
575
576 36 ▶sub set_cell_start {
Subroutine set_cell_start: called CC=2 SCAR=8.4
Pod undocumented
577 36 my ($self, # instance_ref
578 $value # value to set
579 ) = @_;
580
581 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
582 0 warn ("Cannot set CellStart after configuration has been completed in ".(caller(3))[3]."\n");
583 0 return;
584 }
585
586 36 $self->{CellStart} = $value;
587 }
588
589 97 ▶sub get_cell_start {
Subroutine get_cell_start: called CC=1 SCAR=0.0
Pod undocumented
590 97 my ($self, # instance_ref
591 ) = @_;
592
593 97 return $self->{CellStart};
594 }
595
596 # --- CellEnd ---------------------------------------------------------------
597
598 36 ▶sub set_cell_end {
Subroutine set_cell_end: called CC=2 SCAR=8.4
Pod undocumented
599 36 my ($self, # instance_ref
600 $value # value to set
601 ) = @_;
602
603 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
604 0 warn ("Cannot set CellEnd after configuration has been completed in ".(caller(3))[3]."\n");
605 0 return;
606 }
607
608 36 $self->{CellEnd} = $value;
609 }
610
611 113 ▶sub get_cell_end {
Subroutine get_cell_end: called CC=1 SCAR=0.0
Pod undocumented
612 113 my ($self, # instance_ref
613 ) = @_;
614
615 113 return $self->{CellEnd};
616 }
617
618 # --- HeaderLine ---------------------------------------------------------------
619
620 36 ▶sub set_header_line {
Subroutine set_header_line: called CC=2 SCAR=8.4
Pod undocumented
621 36 my ($self, # instance_ref
622 $value # value to set
623 ) = @_;
624
625 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
626 0 warn ("Cannot set HeaderLine after configuration has been completed in ".(caller(3))[3]."\n");
627 0 return;
628 }
629
630 36 $self->{HeaderLine} = $value;
631 }
632
633 8 ▶sub get_header_line {
Subroutine get_header_line: called CC=1 SCAR=0.0
Pod undocumented
634 8 my ($self, # instance_ref
635 ) = @_;
636
637 8 return $self->{HeaderLine};
638 }
639
640 # --- SeparatorLine ---------------------------------------------------------------
641
642 36 ▶sub set_separator_line {
Subroutine set_separator_line: called CC=2 SCAR=8.4
Pod undocumented
643 36 my ($self, # instance_ref
644 $value # value to set
645 ) = @_;
646
647 36 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 36 36
648 0 warn ("Cannot set SeparatorLine after configuration has been completed in ".(caller(3))[3]."\n");
649 0 return;
650 }
651
652 36 $self->{SeparatorLine} = $value;
653 }
654
655 0 ▶sub get_separator_line {
Subroutine get_separator_line: not called CC=1 SCAR=6.9
Pod undocumented
656 0 my ($self, # instance_ref
657 ) = @_;
658
659 0 return $self->{SeparatorLine};
660 }
661
662 # --- BoldHeaderLine ---------------------------------------------------------------
663
664 32 ▶sub set_bold_header_line {
Subroutine set_bold_header_line: called CC=2 SCAR=8.4
Pod undocumented
665 32 my ($self, # instance_ref
666 $value # value to set
667 ) = @_;
668
669 32 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 32 32
670 0 warn ("Cannot set BoldHeaderLine after configuration has been completed in ".(caller(3))[3]."\n");
671 0 return;
672 }
673
674 32 $self->{BoldHeaderLine} = $value;
675 }
676
677 8 ▶sub get_bold_header_line {
Subroutine get_bold_header_line: called CC=1 SCAR=0.0
Pod undocumented
678 8 my ($self, # instance_ref
679 ) = @_;
680
681 8 return $self->{BoldHeaderLine};
682 }
683
684 # --- Bold ---------------------------------------------------------------
685
686 19 ▶sub set_bold {
Subroutine set_bold: called CC=2 SCAR=8.4
Pod undocumented
687 19 my ($self, # instance_ref
688 $value # value to set
689 ) = @_;
690
691 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
692 0 warn ("Cannot set Bold after configuration has been completed in ".(caller(3))[3]."\n");
693 0 return;
694 }
695
696 19 $self->{Bold} = $value;
697 }
698
699 0 ▶sub get_bold {
Subroutine get_bold: not called CC=1 SCAR=6.9
Pod undocumented
700 0 my ($self, # instance_ref
701 ) = @_;
702
703 0 return $self->{Bold};
704 }
705
706 # --- Italics ---------------------------------------------------------------
707
708 19 ▶sub set_italics {
Subroutine set_italics: called CC=2 SCAR=8.4
Pod undocumented
709 19 my ($self, # instance_ref
710 $value # value to set
711 ) = @_;
712
713 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
714 0 warn ("Cannot set Italics after configuration has been completed in ".(caller(3))[3]."\n");
715 0 return;
716 }
717
718 19 $self->{Italics} = $value;
719 }
720
721 0 ▶sub get_italics {
Subroutine get_italics: not called CC=1 SCAR=6.9
Pod undocumented
722 0 my ($self, # instance_ref
723 ) = @_;
724
725 0 return $self->{Italics};
726 }
727
728 # --- Left ---------------------------------------------------------------
729
730 19 ▶sub set_left {
Subroutine set_left: called CC=2 SCAR=8.4
Pod undocumented
731 19 my ($self, # instance_ref
732 $value # value to set
733 ) = @_;
734
735 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
736 0 warn ("Cannot set Left after configuration has been completed in ".(caller(3))[3]."\n");
737 0 return;
738 }
739
740 19 $self->{Left} = $value;
741 }
742
743 0 ▶sub get_left {
Subroutine get_left: not called CC=1 SCAR=6.9
Pod undocumented
744 0 my ($self, # instance_ref
745 ) = @_;
746
747 0 return $self->{Left};
748 }
749
750 # --- Right ---------------------------------------------------------------
751
752 19 ▶sub set_right {
Subroutine set_right: called CC=2 SCAR=8.4
Pod undocumented
753 19 my ($self, # instance_ref
754 $value # value to set
755 ) = @_;
756
757 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
758 0 warn ("Cannot set Right after configuration has been completed in ".(caller(3))[3]."\n");
759 0 return;
760 }
761
762 19 $self->{Right} = $value;
763 }
764
765 0 ▶sub get_right {
Subroutine get_right: not called CC=1 SCAR=6.9
Pod undocumented
766 0 my ($self, # instance_ref
767 ) = @_;
768
769 0 return $self->{Right};
770 }
771
772 # --- Center ---------------------------------------------------------------
773
774 19 ▶sub set_center {
Subroutine set_center: called CC=2 SCAR=8.4
Pod undocumented
775 19 my ($self, # instance_ref
776 $value # value to set
777 ) = @_;
778
779 19 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 19 19
780 0 warn ("Cannot set Center after configuration has been completed in ".(caller(3))[3]."\n");
781 0 return;
782 }
783
784 19 $self->{Center} = $value;
785 }
786
787 0 ▶sub get_center {
Subroutine get_center: not called CC=1 SCAR=6.9
Pod undocumented
788 0 my ($self, # instance_ref
789 ) = @_;
790
791 0 return $self->{Center};
792 }
793
794 # --- HorizontalSeparationStart ---------------------------------------------------------------
795
796 33 ▶sub set_horizontal_separation_start {
Subroutine set_horizontal_separation_start: called CC=2 SCAR=8.4
Pod undocumented
797 33 my ($self, # instance_ref
798 $value # value to set
799 ) = @_;
800
801 33 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 33 33
802 0 warn ("Cannot set HorizontalSeparationStart after configuration has been completed in ".(caller(3))[3]."\n");
803 0 return;
804 }
805
806 33 $self->{HorizontalSeparationStart} = $value;
807 }
808
809 20 ▶sub get_horizontal_separation_start {
Subroutine get_horizontal_separation_start: called CC=1 SCAR=0.0
Pod undocumented
810 20 my ($self, # instance_ref
811 ) = @_;
812
813 20 return $self->{HorizontalSeparationStart};
814 }
815
816 # --- HorizontalSeparationEnd ---------------------------------------------------------------
817
818 33 ▶sub set_horizontal_separation_end {
Subroutine set_horizontal_separation_end: called CC=2 SCAR=8.4
Pod undocumented
819 33 my ($self, # instance_ref
820 $value # value to set
821 ) = @_;
822
823 33 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 33 33
824 0 warn ("Cannot set HorizontalSeparationEnd after configuration has been completed in ".(caller(3))[3]."\n");
825 0 return;
826 }
827
828 33 $self->{HorizontalSeparationEnd} = $value;
829 }
830
831 20 ▶sub get_horizontal_separation_end {
Subroutine get_horizontal_separation_end: called CC=1 SCAR=0.0
Pod undocumented
832 20 my ($self, # instance_ref
833 ) = @_;
834
835 20 return $self->{HorizontalSeparationEnd};
836 }
837
838 # --- HorizontalSeparationColumnSeparator ---------------------------------------------------------------
839
840 29 ▶sub set_horizontal_separation_column_separator {
Subroutine set_horizontal_separation_column_separator: called CC=2 SCAR=8.4
Pod undocumented
841 29 my ($self, # instance_ref
842 $value # value to set
843 ) = @_;
844
845 29 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 29 29
846 0 warn ("Cannot set HorizontalSeparationColumnSeparator after configuration has been completed in ".(caller(3))[3]."\n");
847 0 return;
848 }
849
850 29 $self->{HorizontalSeparationColumnSeparator} = $value;
851 }
852
853 114 ▶sub get_horizontal_separation_column_separator {
Subroutine get_horizontal_separation_column_separator: called CC=1 SCAR=0.0
Pod undocumented
854 114 my ($self, # instance_ref
855 ) = @_;
856
857 114 return $self->{HorizontalSeparationColumnSeparator};
858 }
859
860 # --- HorizontalSeparationChar ---------------------------------------------------------------
861
862 29 ▶sub set_horizontal_separation_char {
Subroutine set_horizontal_separation_char: called CC=2 SCAR=8.4
Pod undocumented
863 29 my ($self, # instance_ref
864 $value # value to set
865 ) = @_;
866
867 29 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 29 29
868 0 warn ("Cannot set HorizontalSeparationChar after configuration has been completed in ".(caller(3))[3]."\n");
869 0 return;
870 }
871
872 29 $self->{HorizontalSeparationChar} = $value;
873 }
874
875 82 ▶sub get_horizontal_separation_char {
Subroutine get_horizontal_separation_char: called CC=1 SCAR=0.0
Pod undocumented
876 82 my ($self, # instance_ref
877 ) = @_;
878
879 82 return $self->{HorizontalSeparationChar};
880 }
881
882 # --- HorizontalSeparationBoldChar ---------------------------------------------------------------
883
884 29 ▶sub set_horizontal_separation_bold_char {
Subroutine set_horizontal_separation_bold_char: called CC=2 SCAR=8.4
Pod undocumented
885 29 my ($self, # instance_ref
886 $value # value to set
887 ) = @_;
888
889 29 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 29 29
890 0 warn ("Cannot set HorizontalSeparationBoldChar after configuration has been completed in ".(caller(3))[3]."\n");
891 0 return;
892 }
893
894 29 $self->{HorizontalSeparationBoldChar} = $value;
895 }
896
897 82 ▶sub get_horizontal_separation_bold_char {
Subroutine get_horizontal_separation_bold_char: called CC=1 SCAR=0.0
Pod undocumented
898 82 my ($self, # instance_ref
899 ) = @_;
900
901 82 return $self->{HorizontalSeparationBoldChar};
902 }
903
904 # --- ConfigureColumnAction ---------------------------------------------------------------
905
906 17 ▶sub set_configure_column_action {
Subroutine set_configure_column_action: called CC=2 SCAR=8.4
Pod undocumented
907 17 my ($self, # instance_ref
908 $value # value to set
909 ) = @_;
910
911 17 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 17 17
912 0 warn ("Cannot set ConfigureColumnAction after configuration has been completed in ".(caller(3))[3]."\n");
913 0 return;
914 }
915
916 17 $self->{ConfigureColumnAction} = $value;
917 }
918
919 83 ▶sub get_configure_column_action {
Subroutine get_configure_column_action: called CC=1 SCAR=0.0
Pod undocumented
920 83 my ($self, # instance_ref
921 ) = @_;
922
923 83 return $self->{ConfigureColumnAction};
924 }
925
926 # --- ConfigureCompleteAction ---------------------------------------------------------------
927
928 17 ▶sub set_configure_complete_action {
Subroutine set_configure_complete_action: called CC=2 SCAR=8.4
Pod undocumented
929 17 my ($self, # instance_ref
930 $value # value to set
931 ) = @_;
932
933 17 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 17 17
934 0 warn ("Cannot set ConfigureCompleteAction after configuration has been completed in ".(caller(3))[3]."\n");
935 0 return;
936 }
937
938 17 $self->{ConfigureCompleteAction} = $value;
939 }
940
941 17 ▶sub get_configure_complete_action {
Subroutine get_configure_complete_action: called CC=1 SCAR=0.0
Pod undocumented
942 17 my ($self, # instance_ref
943 ) = @_;
944
945 17 return $self->{ConfigureCompleteAction};
946 }
947
948 # --- default_cell_value ---------------------------------------------------------------
949
950 10 ▶sub set_default_cell_value {
Subroutine set_default_cell_value: called CC=2 SCAR=8.4
Pod undocumented
951 10 my ($self, # instance_ref
952 $value # value to set
953 ) = @_;
954
955 10 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 10 10
956 0 warn ("Cannot set default_cell_value after configuration has been completed in ".(caller(3))[3]."\n");
957 0 return;
958 }
959
960 10 $self->{default_cell_value} = $value;
961 }
962
963 83 ▶sub get_default_cell_value {
Subroutine get_default_cell_value: called CC=1 SCAR=0.0
Pod undocumented
964 83 my ($self, # instance_ref
965 ) = @_;
966
967 83 return $self->{default_cell_value};
968 }
969
970 # --- CellOutputAction ---------------------------------------------------------------
971
972 0 ▶sub set_cell_output_action {
Subroutine set_cell_output_action: not called CC=2 SCAR=17.9
Pod undocumented
973 0 my ($self, # instance_ref
974 $value # value to set
975 ) = @_;
976
977 0 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 0 0
978 0 warn ("Cannot set CellOutputAction after configuration has been completed in ".(caller(3))[3]."\n");
979 0 return;
980 }
981
982 0 $self->{CellOutputAction} = $value;
983 }
984
985 0 ▶sub get_cell_output_action {
Subroutine get_cell_output_action: not called CC=1 SCAR=6.9
Pod undocumented
986 0 my ($self, # instance_ref
987 ) = @_;
988
989 0 return $self->{CellOutputAction};
990 }
991
992 # --- HeaderOutputAction ---------------------------------------------------------------
993
994 17 ▶sub set_header_output_action {
Subroutine set_header_output_action: called CC=2 SCAR=8.4
Pod undocumented
995 17 my ($self, # instance_ref
996 $value # value to set
997 ) = @_;
998
999 17 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 17 17
1000 0 warn ("Cannot set HeaderOutputAction after configuration has been completed in ".(caller(3))[3]."\n");
1001 0 return;
1002 }
1003
1004 17 $self->{HeaderOutputAction} = $value;
1005 }
1006
1007 10 ▶sub get_header_output_action {
Subroutine get_header_output_action: called CC=1 SCAR=0.0
Pod undocumented
1008 10 my ($self, # instance_ref
1009 ) = @_;
1010
1011 10 return $self->{HeaderOutputAction};
1012 }
1013
1014 # --- RowOutputAction ---------------------------------------------------------------
1015
1016 17 ▶sub set_row_output_action {
Subroutine set_row_output_action: called CC=2 SCAR=8.4
Pod undocumented
1017 17 my ($self, # instance_ref
1018 $value # value to set
1019 ) = @_;
1020
1021 17 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 17 17
1022 0 warn ("Cannot set RowOutputAction after configuration has been completed in ".(caller(3))[3]."\n");
1023 0 return;
1024 }
1025
1026 17 $self->{RowOutputAction} = $value;
1027 }
1028
1029 17 ▶sub get_row_output_action {
Subroutine get_row_output_action: called CC=1 SCAR=0.0
Pod undocumented
1030 17 my ($self, # instance_ref
1031 ) = @_;
1032
1033 17 return $self->{RowOutputAction};
1034 }
1035
1036 # --- StartTableOutputAction ---------------------------------------------------------------
1037
1038 17 ▶sub set_start_table_output_action {
Subroutine set_start_table_output_action: called CC=2 SCAR=8.4
Pod undocumented
1039 17 my ($self, # instance_ref
1040 $value # value to set
1041 ) = @_;
1042
1043 17 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 17 17
1044 0 warn ("Cannot set StartTableOutputAction after configuration has been completed in ".(caller(3))[3]."\n");
1045 0 return;
1046 }
1047
1048 17 $self->{StartTableOutputAction} = $value;
1049 }
1050
1051 10 ▶sub get_start_table_output_action {
Subroutine get_start_table_output_action: called CC=1 SCAR=0.0
Pod undocumented
1052 10 my ($self, # instance_ref
1053 ) = @_;
1054
1055 10 return $self->{StartTableOutputAction};
1056 }
1057
1058 # --- EndTableOutputAction ---------------------------------------------------------------
1059
1060 17 ▶sub set_end_table_output_action {
Subroutine set_end_table_output_action: called CC=2 SCAR=8.4
Pod undocumented
1061 17 my ($self, # instance_ref
1062 $value # value to set
1063 ) = @_;
1064
1065 17 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 17 17
1066 0 warn ("Cannot set EndTableOutputAction after configuration has been completed in ".(caller(3))[3]."\n");
1067 0 return;
1068 }
1069
1070 17 $self->{EndTableOutputAction} = $value;
1071 }
1072
1073 10 ▶sub get_end_table_output_action {
Subroutine get_end_table_output_action: called CC=1 SCAR=0.0
Pod undocumented
1074 10 my ($self, # instance_ref
1075 ) = @_;
1076
1077 10 return $self->{EndTableOutputAction};
1078 }
1079
1080 # --- RowGroupChangesAction --------------------------------------------------
1081
1082 0 ▶sub set_row_group_changes_action {
Subroutine set_row_group_changes_action: not called CC=2 SCAR=17.9
Pod undocumented
1083 0 my ($self, # instance_ref
1084 $value # value to set
1085 ) = @_;
1086
1087 0 ▶ if ($self->configure_is_complete()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configure_is_complete) 0 0 0
1088 0 warn ("Cannot set RowGroupChangesAction after configuration has been completed in ".(caller(3))[3]."\n");
1089 0 return;
1090 }
1091
1092 0 $self->{RowGroupChangesAction} = $value;
1093 }
1094
1095 62 ▶sub get_row_group_changes_action {
Subroutine get_row_group_changes_action: called CC=1 SCAR=0.0
Pod undocumented
1096 62 my ($self, # instance_ref
1097 ) = @_;
1098
1099 62 return $self->{RowGroupChangesAction};
1100 }
1101
1102 # --- verbose ---------------------------------------------------------------
1103
1104 21 ▶sub set_verbose {
Subroutine set_verbose: called CC=1 SCAR=0.0
Pod undocumented
1105 21 my ($self, # instance_ref
1106 $value # value to set
1107 ) = @_;
1108
1109 21 $self->{verbose} = $value;
1110 }
1111
1112 1123 ▶sub get_verbose {
Subroutine get_verbose: called CC=1 SCAR=0.0
Pod undocumented
1113 1123 my ($self, # instance_ref
1114 ) = @_;
1115
1116 1123 return $self->{verbose};
1117 }
1118
1119 #--------------------------------------------------------------------------------
1120 #
1121 # Methods
1122 #
1123 #--------------------------------------------------------------------------------
1124
1125 # --- CellOutputActions ---------------------------------------------------------------
1126
1127 83 ▶sub add_cell_output_action {
Subroutine add_cell_output_action: called CC=2 SCAR=7.0
Pod undocumented
1128 83 my ($self, # instance_ref
1129 $value # value to set
1130 ) = @_;
1131
1132 83 my $cell_output_actions_ref = $self->{CellOutputActions};
1133
1134 83 ▶ print "### add_cell_output_action: $value\n" if verbose($self, 3);
Branch: 1 branch
BranchTrueFalseTotal
if verbose($self, 3) 0 83 83
1135
1136 83 push (@$cell_output_actions_ref, $value);
1137 }
1138
1139 66 ▶sub get_cell_output_actions {
Subroutine get_cell_output_actions: called CC=1 SCAR=0.0
Pod undocumented
1140 66 my ($self, # instance_ref
1141 ) = @_;
1142
1143 66 return $self->{CellOutputActions};
1144 }
1145
1146 # --- store name and action for column ------------------------------------------
1147 50 ▶sub cc {
Subroutine cc: called CC=1 SCAR=0.0
Pod undocumented
1148 50 my $self = shift; # instance_ref
1149 50 $self->configure_column(@_);
1150 }
1151
1152 # --- store name and action for column ------------------------------------------
1153 0 ▶sub conf_col {
Subroutine conf_col: not called CC=1 SCAR=6.9
Pod undocumented
1154 0 my $self = shift; # instance_ref
1155 0 $self->configure_column(@_);
1156 }
1157
1158 # --- store name and action for column ------------------------------------------
1159 83 ▶sub configure_column {
Subroutine configure_column: called CC=2 SCAR=7.0
Pod undocumented
1160 83 my $self = $_[0]; # instance_ref
1161
1162 83 my $action = $self->get_configure_column_action();
1163
1164 83 ▶ die "no action to store export column defined!" unless ref ($action);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $action 0 83 83
1165
1166 83 $action->(@_);
1167 }
1168
1169 # --- create action and trace --------------------------------------------------
1170 77 ▶sub create_action {
Subroutine create_action: called CC=3 SCAR=11.2
Pod undocumented
1171 77 my ($self, # instance_ref
1172 $action_str # will be evaled to a sub { ... }
1173 ) = @_;
1174
1175 77 my $eval_str = 'sub { '.$action_str.' }';
1176
1177 77 ▶ print "### eval_str = $eval_str\n" if verbose($self, 3);
Branch: 1 branch
BranchTrueFalseTotal
if verbose($self, 3) 0 77 77
1178
1179 77 my $sub_ref = eval ($eval_str);
1180
1181 77 ▶ print "### ref(sub_ref) ".ref($sub_ref) ."\n" if verbose($self, 3);
Branch: 1 branch
BranchTrueFalseTotal
if verbose($self, 3) 0 77 77
1182 77 return $sub_ref;
1183 }
1184
1185 # --- Now all columns are defined ---------------------------
1186 17 ▶sub configure_complete {
Subroutine configure_complete: called CC=2 SCAR=7.0
Pod undocumented
1187 17 my $self = $_[0]; # instance_ref
1188
1189 17 my $action = $self->get_configure_complete_action();
1190
1191 17 ▶ die "no action to complete configuration defined!" unless ref ($action);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $action 0 17 17
1192
1193 17 $action->(@_);
1194
1195 17 $self->{configure_complete} = 1;
1196 }
1197
1198 # --- Now all columns are defined ---------------------------
1199 1121 ▶sub configure_is_complete {
Subroutine configure_is_complete: called CC=1 SCAR=0.0
Pod undocumented
1200 1121 my $self = $_[0]; # instance_ref
1201
1202 1121 return $self->{configure_complete};
1203 }
1204
1205 # --- get table header row output ---------------------
1206 10 ▶sub get_header_output {
Subroutine get_header_output: called CC=3 SCAR=11.3
Pod undocumented
1207 10 my ($self, # instance_ref
1208 $headers_ref, # optional: ref to array with header texts
1209 ) = @_;
1210
1211 10 my $action = $self->get_header_output_action();
1212 10 ▶ die "No action to output header defined!" unless $action;
Branch: 1 branch
BranchTrueFalseTotal
unless $action 0 10 10
1213
1214 10 ▶ $headers_ref = $self->get_header_texts_ref() unless $headers_ref;
Branch: 1 branch
BranchTrueFalseTotal
unless $headers_ref 10 0 10
1215
1216 10 $action->($self, $headers_ref);
1217 }
1218
1219 # --- get output of given row ---------------------
1220 7 ▶sub get_row_output {
Subroutine get_row_output: called CC=2 SCAR=7.0
Pod undocumented
1221 7 my ($self, # instance_ref
1222 $data_ref # data to give out
1223 ) = @_;
1224
1225 7 my $action = $self->get_row_output_action();
1226 7 ▶ die "No action to output row defined!" unless $action;
Branch: 1 branch
BranchTrueFalseTotal
unless $action 0 7 7
1227
1228 7 $action->($self, $data_ref);
1229 }
1230
1231 # --- get output of (table) start ---------------------
1232 10 ▶sub get_output_start {
Subroutine get_output_start: called CC=2 SCAR=7.0
Pod undocumented
1233 10 my ($self, # instance_ref
1234 $data_ref # data to give out
1235 ) = @_;
1236
1237 10 my $action = $self->get_start_table_output_action();
1238 10 ▶ die "No action to start table defined!" unless $action;
Branch: 1 branch
BranchTrueFalseTotal
unless $action 0 10 10
1239
1240 10 $action->($self, $data_ref);
1241 }
1242
1243 # --- get output of (table) end ---------------------
1244 10 ▶sub get_output_end {
Subroutine get_output_end: called CC=2 SCAR=7.0
Pod undocumented
1245 10 my ($self, # instance_ref
1246 $data_ref # data to give out
1247 ) = @_;
1248
1249 10 my $action = $self->get_end_table_output_action();
1250 10 ▶ die "No action to end table defined!" unless $action;
Branch: 1 branch
BranchTrueFalseTotal
unless $action 0 10 10
1251
1252 10 $action->($self, $data_ref);
1253 }
1254
1255 # --- Interprete File Parameter and return open file handle ---
1256 10 ▶sub interprete_file_parameter {
Subroutine interprete_file_parameter: called CC=5 SCAR=18.0
Pod undocumented
1257 10 my ($self, # instance_ref
1258 $file_parameter # FileHandle or file name for output
1259 ) = @_;
1260
1261 10 my $file_handle;
1262
1263 10 ▶ if ($file_parameter) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file_parameter) { } 6 4 10
1264 6 my $file_ref = ref($file_parameter);
1265
1266 6 ▶ if ($file_ref) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file_ref) { } 6 0 6
1267 6 ▶ unless ($file_ref =~ /^FileHandle$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($file_ref =~ /^FileHandle$/) 0 6 6
1268 0 croak 'Only FileHandle or $file_name_string allowed as file parameter!';
1269 }
1270 6 $file_handle = $file_parameter;
1271 }
1272 else {
1273 0 $file_handle = FileHandle->new($file_parameter, 'w');
1274 0 ▶ croak "can't open file '$file_parameter' to write: $!\n" unless $file_handle;
Branch: 1 branch
BranchTrueFalseTotal
unless $file_handle 0 0 0
1275 }
1276 }
1277 else {
1278 4 $file_handle = *STDOUT;
1279 }
1280
1281 10 return $file_handle;
1282 }
1283
1284
1285 # --- Write out everything in one step ----
1286 10 ▶sub write_all {
Subroutine write_all: called CC=2 SCAR=6.9
Pod undocumented
1287 10 my ($self, # instance_ref
1288 $data_rows_ref, # list of data_rows to give out
1289 $file_parameter # Optional: FileHandle or file name for output
1290 ) = @_;
1291
1292 10 my $file_handle = $self->interprete_file_parameter($file_parameter);
1293
1294 10 print $file_handle $self->get_output_start();
1295
1296 10 my $row_output_action = $self->get_row_output_action();
1297
1298 10 foreach my $data (@{$data_rows_ref}) {
1299 55 print $file_handle $row_output_action->($self, $data);
1300 }
1301
1302 10 print $file_handle $self->get_output_end();
1303 }
1304
1305
1306 1 1;
1307
1308 =head1 NAME
1309
1310 C<Report::Porf::Table::Simple>
1311
1312 Reports for any output format as simple table:
1313 One line in output per data row.
1314
1315 Part of Perl Open Report Framework (Porf).
1316
1317 =head1 Documentation
1318
1319 Use C<Configurator> or C<Framework> of namespace C<Report::Porf::*> to
1320 create Instances, that export data as text, html, csv, LaTeX, for
1321 wikis or Excel.
1322
1323 See Framework.pm for documentation of features and usage.
1324
1325 =head1 LICENSE AND COPYRIGHT
1326
1327 Copyright (c) 2013 by Ralf Peine, Germany. All rights reserved.
1328
1329 This library is free software; you can redistribute it and/or modify
1330 it under the same terms as Perl itself, either Perl version 5.6.0 or,
1331 at your option, any later version of Perl 5 you may have available.
1332
1333 =head1 DISCLAIMER OF WARRANTY
1334
1335 This library is distributed in the hope that it will be useful,
1336 but without any warranty; without even the implied warranty of
1337 merchantability or fitness for a particular purpose.
1338
1339 =cut
« Porf/rename_subs.pl ↑ Summary Porf/examples/Person.pm »