| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Copyright (C) 2003-2007, G. Allen Morris III, all rights reserved |
|
2
|
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
52
|
use strict; |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
2589
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Data::Tabular::Table; |
|
6
|
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
4567
|
use Data::Tabular::Column; |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
844
|
|
|
8
|
7
|
|
|
7
|
|
47
|
use Carp qw (croak); |
|
|
7
|
|
|
|
|
17
|
|
|
|
7
|
|
|
|
|
336
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
4816
|
use Data::Tabular::Config::Output; |
|
|
7
|
|
|
|
|
26
|
|
|
|
7
|
|
|
|
|
7823
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new |
|
13
|
|
|
|
|
|
|
{ |
|
14
|
27
|
|
|
27
|
1
|
1695
|
my $caller = shift; |
|
15
|
27
|
|
33
|
|
|
139
|
my $class = ref($caller) || $caller; |
|
16
|
27
|
|
|
|
|
56
|
my $self = {}; |
|
17
|
27
|
|
|
|
|
100
|
my $args = { @_ }; |
|
18
|
27
|
|
|
|
|
48
|
my $old = {}; |
|
19
|
|
|
|
|
|
|
|
|
20
|
27
|
100
|
|
|
|
90
|
if (my $table = $args->{table}) { |
|
21
|
18
|
|
|
|
|
81
|
for my $key (keys %$table) { |
|
22
|
36
|
|
|
|
|
102
|
$old->{$key} = $table->{$key}; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
18
|
|
|
|
|
47
|
delete $args->{table}; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
27
|
50
|
|
|
|
69
|
if (ref($caller)) { |
|
28
|
0
|
|
|
|
|
0
|
for my $key (keys %$caller) { |
|
29
|
0
|
|
|
|
|
0
|
$old->{$key} = $caller->{$key}; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
} |
|
32
|
27
|
|
|
|
|
103
|
$self = { %$old, %$args }; |
|
33
|
27
|
|
|
|
|
96
|
bless $self, $class; |
|
34
|
|
|
|
|
|
|
|
|
35
|
27
|
50
|
|
|
|
214
|
die unless $self->{data}; |
|
36
|
|
|
|
|
|
|
|
|
37
|
27
|
|
|
|
|
125
|
$self; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub headers |
|
41
|
|
|
|
|
|
|
{ |
|
42
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
0
|
$self->{headers}; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub columns |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
5
|
|
|
5
|
1
|
12
|
my $self = shift; |
|
50
|
|
|
|
|
|
|
|
|
51
|
5
|
|
|
|
|
36
|
my @headers = $self->headers; |
|
52
|
|
|
|
|
|
|
|
|
53
|
5
|
|
|
|
|
15
|
my $x = 0; |
|
54
|
53
|
|
|
|
|
217
|
map({ |
|
55
|
5
|
|
|
|
|
22
|
Data::Tabular::Column->new( |
|
56
|
|
|
|
|
|
|
@_, |
|
57
|
|
|
|
|
|
|
offset => $x++, |
|
58
|
|
|
|
|
|
|
name => $_, |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
} @headers); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _title |
|
64
|
|
|
|
|
|
|
{ |
|
65
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
66
|
0
|
|
|
|
|
|
my $column_name = shift; |
|
67
|
0
|
|
|
|
|
|
my $title = q|/|. $column_name . q|/|; |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
warn "FIXME"; |
|
70
|
0
|
|
|
|
|
|
$title; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub header_offset |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
76
|
0
|
|
|
|
|
|
my $column = shift; |
|
77
|
0
|
|
|
|
|
|
my $count = 0; |
|
78
|
0
|
0
|
|
|
|
|
unless ($self->{_header_off}) { |
|
79
|
0
|
|
|
|
|
|
for my $header ($self->headers) { |
|
80
|
0
|
|
|
|
|
|
$self->{_header_off}->{$header} = $count++; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
} |
|
83
|
0
|
|
|
|
|
|
my $ret = $self->{_header_off}->{$column}; |
|
84
|
0
|
|
|
|
|
|
croak "column '$column' not found in [", |
|
85
|
|
|
|
|
|
|
join(" ", |
|
86
|
0
|
0
|
|
|
|
|
sort keys(%{$self->{_header_off}}) |
|
87
|
|
|
|
|
|
|
), ']' unless defined $ret; |
|
88
|
0
|
|
|
|
|
|
$ret; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
|
93
|
|
|
|
|
|
|
__END__ |