line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Term::Table::CellStack; |
2
|
1
|
|
|
1
|
|
77042
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
33
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.017'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Term::Table::HashBase qw/-cells -idx/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use List::Util qw/max/; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
310
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init { |
12
|
2
|
|
|
2
|
0
|
3
|
my $self = shift; |
13
|
2
|
|
50
|
|
|
19
|
$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
|
4
|
my $self = shift; |
33
|
2
|
|
|
|
|
4
|
$_->mark_tail(@_) for @{$self->{+CELLS}}; |
|
2
|
|
|
|
|
6
|
|
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
|
|
8
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
116
|
|
43
|
|
|
|
|
|
|
*$meth = sub { |
44
|
105
|
|
|
105
|
|
146
|
my $self = shift; |
45
|
105
|
|
|
|
|
242
|
$self->{+CELLS}->[$self->{+IDX}]->$meth; |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
for my $meth (qw{value_width width}) { |
50
|
1
|
|
|
1
|
|
8
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
337
|
|
51
|
|
|
|
|
|
|
*$meth = sub { |
52
|
2
|
|
|
2
|
|
4
|
my $self = shift; |
53
|
2
|
|
|
|
|
4
|
return max(map { $_->$meth } @{$self->{+CELLS}}); |
|
6
|
|
|
|
|
132
|
|
|
2
|
|
|
|
|
5
|
|
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub next { |
58
|
38
|
|
|
38
|
0
|
46
|
my $self = shift; |
59
|
38
|
|
|
|
|
63
|
my ($cw) = @_; |
60
|
|
|
|
|
|
|
|
61
|
38
|
|
|
|
|
53
|
while ($self->{+IDX} < @{$self->{+CELLS}}) { |
|
44
|
|
|
|
|
87
|
|
62
|
27
|
|
|
|
|
44
|
my $cell = $self->{+CELLS}->[$self->{+IDX}]; |
63
|
|
|
|
|
|
|
|
64
|
27
|
|
|
|
|
70
|
my $lw = $cell->border_left_width; |
65
|
27
|
|
|
|
|
147
|
my $rw = $cell->border_right_width; |
66
|
27
|
|
|
|
|
120
|
my $vw = $cw - $lw - $rw; |
67
|
27
|
|
|
|
|
51
|
my $it = $cell->break->next($vw); |
68
|
|
|
|
|
|
|
|
69
|
27
|
100
|
|
|
|
89
|
return ($it, $vw) if $it; |
70
|
6
|
|
|
|
|
11
|
$self->{+IDX}++; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
17
|
|
|
|
|
37
|
return; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
38
|
|
|
38
|
0
|
75
|
sub break { $_[0] } |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub reset { |
79
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
80
|
2
|
|
|
|
|
4
|
$self->{+IDX} = 0; |
81
|
2
|
|
|
|
|
3
|
$_->reset for @{$self->{+CELLS}}; |
|
2
|
|
|
|
|
6
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |