line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (C) 2003-2007, G. Allen Morris III, all rights reserved |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
30
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
622
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package |
6
|
|
|
|
|
|
|
Data::Tabular::Row::Extra; |
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
30
|
use base 'Data::Tabular::Row'; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
3588
|
|
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
41
|
use Carp qw (croak); |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
4319
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
97
|
|
|
97
|
0
|
148
|
my $caller = shift; |
15
|
97
|
|
|
|
|
359
|
my $self = $caller->SUPER::new(@_); |
16
|
|
|
|
|
|
|
|
17
|
97
|
50
|
|
|
|
264
|
croak unless $self->{extra}; |
18
|
|
|
|
|
|
|
|
19
|
97
|
|
|
|
|
472
|
$self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub get_column |
23
|
|
|
|
|
|
|
{ |
24
|
1813
|
|
|
1813
|
0
|
2398
|
my $self = shift; |
25
|
1813
|
|
|
|
|
2381
|
my $column_name = shift; |
26
|
1813
|
|
|
|
|
10710
|
my $ret; |
27
|
|
|
|
|
|
|
|
28
|
1813
|
|
|
|
|
3450
|
my $row = $self->{input_row}; |
29
|
|
|
|
|
|
|
|
30
|
1813
|
100
|
|
|
|
6896
|
if ($self->table()->is_extra($column_name)) { |
31
|
418
|
50
|
|
|
|
1862
|
die "circulare reference for $column_name (" . join(' ', @{$self->{last}}) . ')' . Dumper $self . join(' ', caller) if $self->{_working}->{$column_name}++; |
|
0
|
|
|
|
|
0
|
|
32
|
418
|
|
|
|
|
506
|
push(@{$self->{last}}, $column_name); |
|
418
|
|
|
|
|
1136
|
|
33
|
418
|
|
|
|
|
1047
|
$ret = $self->extra_column($self, $column_name); |
34
|
418
|
|
|
|
|
576
|
pop(@{$self->{last}}); |
|
418
|
|
|
|
|
890
|
|
35
|
418
|
|
|
|
|
943
|
$self->{_working}->{$column_name} = 0; |
36
|
|
|
|
|
|
|
} else { |
37
|
1395
|
|
|
|
|
4999
|
$ret = $self->table()->get_row_column_name($row, $column_name); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
1813
|
|
|
|
|
8592
|
$ret = Data::Tabular::Type::Text->new(data => $ret); |
41
|
|
|
|
|
|
|
|
42
|
1813
|
|
|
|
|
5469
|
$ret; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub extra_package |
46
|
|
|
|
|
|
|
{ |
47
|
418
|
|
|
418
|
0
|
2718
|
require Data::Tabular::Extra; |
48
|
418
|
|
|
|
|
1760
|
'Data::Tabular::Extra'; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub get |
52
|
|
|
|
|
|
|
{ |
53
|
410
|
|
|
410
|
0
|
533
|
my $self = shift; |
54
|
410
|
|
|
|
|
924
|
$self->get_column(@_); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub extra_column |
58
|
|
|
|
|
|
|
{ |
59
|
418
|
|
|
418
|
0
|
505
|
my $self = shift; |
60
|
418
|
|
|
|
|
475
|
my $row = shift; |
61
|
418
|
|
|
|
|
569
|
my $key = shift; |
62
|
|
|
|
|
|
|
|
63
|
418
|
|
|
|
|
804
|
my $extra = $self->{extra}->{columns}; |
64
|
|
|
|
|
|
|
|
65
|
418
|
|
|
|
|
511
|
my $ret = undef; |
66
|
|
|
|
|
|
|
|
67
|
418
|
|
|
|
|
910
|
my $x = $self->extra_package->new(row => $row, table => $self); |
68
|
|
|
|
|
|
|
|
69
|
418
|
50
|
|
|
|
5838
|
if (ref($extra->{$key}) eq 'CODE') { |
70
|
418
|
|
|
|
|
604
|
eval { |
71
|
418
|
|
|
|
|
1223
|
$ret = $extra->{$key}->($x); |
72
|
|
|
|
|
|
|
}; |
73
|
418
|
50
|
|
|
|
1906
|
if ($@) { |
74
|
0
|
|
|
|
|
0
|
die $@; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} else { |
77
|
0
|
|
|
|
|
0
|
die 'Only know how to deal with code'; |
78
|
|
|
|
|
|
|
} |
79
|
418
|
100
|
|
|
|
913
|
if (my $t = ref($ret)) { |
80
|
66
|
50
|
|
|
|
211
|
if ($t eq 'HASH') { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# $ret; |
82
|
|
|
|
|
|
|
} elsif ($t eq 'ARRAY') { |
83
|
0
|
|
|
|
|
0
|
die $t; |
84
|
|
|
|
|
|
|
} elsif ($t eq 'SCALAR') { |
85
|
0
|
|
|
|
|
0
|
die $t; |
86
|
|
|
|
|
|
|
} elsif ($t eq 'CODE') { |
87
|
0
|
|
|
|
|
0
|
die $t; |
88
|
|
|
|
|
|
|
} else { |
89
|
|
|
|
|
|
|
# $ret; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} else { |
92
|
352
|
|
|
|
|
816
|
$ret = $self->set_type($ret, $key); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
418
|
|
|
|
|
1332
|
$ret; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub set_type |
99
|
|
|
|
|
|
|
{ |
100
|
352
|
|
|
352
|
0
|
465
|
my $self = shift; |
101
|
352
|
|
|
|
|
625
|
my $date = shift; |
102
|
352
|
|
|
|
|
457
|
my $key = shift; |
103
|
|
|
|
|
|
|
|
104
|
352
|
|
|
|
|
1301
|
Data::Tabular::Type::Text->new(data => $date); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub type |
108
|
|
|
|
|
|
|
{ |
109
|
0
|
|
|
0
|
0
|
|
'normal data'; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
__END__ |