line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Term::Table::CellStack; |
2
|
1
|
|
|
1
|
|
71202
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.016'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use Term::Table::HashBase qw/-cells -idx/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use List::Util qw/max/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
291
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init { |
12
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
13
|
2
|
|
50
|
|
|
9
|
$self->{+CELLS} ||= []; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub add_cell { |
17
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
18
|
0
|
|
|
|
|
0
|
push @{$self->{+CELLS}} => @_; |
|
0
|
|
|
|
|
0
|
|
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub add_cells { |
22
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
23
|
0
|
|
|
|
|
0
|
push @{$self->{+CELLS}} => @_; |
|
0
|
|
|
|
|
0
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub sanitize { |
27
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
28
|
2
|
|
|
|
|
4
|
$_->sanitize(@_) for @{$self->{+CELLS}}; |
|
2
|
|
|
|
|
9
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub mark_tail { |
32
|
2
|
|
|
2
|
0
|
5
|
my $self = shift; |
33
|
2
|
|
|
|
|
3
|
$_->mark_tail(@_) for @{$self->{+CELLS}}; |
|
2
|
|
|
|
|
9
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my @proxy = qw{ |
37
|
|
|
|
|
|
|
border_left border_right border_color value_color reset_color |
38
|
|
|
|
|
|
|
border_left_width border_right_width |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
for my $meth (@proxy) { |
42
|
1
|
|
|
1
|
|
38
|
no strict 'refs'; |
|
1
|
|
|
|
|
18
|
|
|
1
|
|
|
|
|
85
|
|
43
|
|
|
|
|
|
|
*$meth = sub { |
44
|
105
|
|
|
105
|
|
157
|
my $self = shift; |
45
|
105
|
|
|
|
|
252
|
$self->{+CELLS}->[$self->{+IDX}]->$meth; |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
for my $meth (qw{value_width width}) { |
50
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
305
|
|
51
|
|
|
|
|
|
|
*$meth = sub { |
52
|
2
|
|
|
2
|
|
4
|
my $self = shift; |
53
|
2
|
|
|
|
|
4
|
return max(map { $_->$meth } @{$self->{+CELLS}}); |
|
6
|
|
|
|
|
69
|
|
|
2
|
|
|
|
|
5
|
|
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub next { |
58
|
38
|
|
|
38
|
0
|
50
|
my $self = shift; |
59
|
38
|
|
|
|
|
70
|
my ($cw) = @_; |
60
|
|
|
|
|
|
|
|
61
|
38
|
|
|
|
|
52
|
while ($self->{+IDX} < @{$self->{+CELLS}}) { |
|
44
|
|
|
|
|
95
|
|
62
|
27
|
|
|
|
|
47
|
my $cell = $self->{+CELLS}->[$self->{+IDX}]; |
63
|
|
|
|
|
|
|
|
64
|
27
|
|
|
|
|
57
|
my $lw = $cell->border_left_width; |
65
|
27
|
|
|
|
|
146
|
my $rw = $cell->border_right_width; |
66
|
27
|
|
|
|
|
116
|
my $vw = $cw - $lw - $rw; |
67
|
27
|
|
|
|
|
54
|
my $it = $cell->break->next($vw); |
68
|
|
|
|
|
|
|
|
69
|
27
|
100
|
|
|
|
92
|
return ($it, $vw) if $it; |
70
|
6
|
|
|
|
|
13
|
$self->{+IDX}++; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
17
|
|
|
|
|
86
|
return; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
38
|
|
|
38
|
0
|
81
|
sub break { $_[0] } |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub reset { |
79
|
2
|
|
|
2
|
0
|
3
|
my $self = shift; |
80
|
2
|
|
|
|
|
3
|
$self->{+IDX} = 0; |
81
|
2
|
|
|
|
|
4
|
$_->reset for @{$self->{+CELLS}}; |
|
2
|
|
|
|
|
6
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |