Imager/TabularDisplay.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 41 CC 2 SCAR 12.0
CC
2
Cov
0%
generate_table
6.0
print_table
2.0
BEGIN
2.0
CRAP 3.3
1 use strict;
2 use warnings;
3  
4 package Imager::TabularDisplay {
5 use Text::ASCIITable;
6  
7 sub print_table {
8 my $t = generate_table(@_);
9 print $t;
10 }
11
12 sub generate_table {
13 my @cols = @{$_[0]};
14 my @res = @{$_[1]};
15  
16 my $table = Text::ASCIITable->new;
17  
18 $table->setCols(@cols);
19  
20 foreach my $row (sort { ($a->prop('date')||'') cmp ($b->prop('date')||'') } @res) {
21 my @line = map {
22 my $val = $row->prop($_);
23 if (ref($val) eq 'ARRAY') {
24 join ',', @$val;
25 } else {
26 $val
27 }
28 } @cols;
29 $table->addRow(@line);
30 }
31 $table;
32 }
33 }
34 1;