line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Term::Table::CellStack; |
2
|
1
|
|
|
1
|
|
56147
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.015'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Term::Table::HashBase qw/-cells -idx/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use List::Util qw/max/; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
267
|
|
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
|
3
|
my $self = shift; |
28
|
2
|
|
|
|
|
3
|
$_->sanitize(@_) for @{$self->{+CELLS}}; |
|
2
|
|
|
|
|
8
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub mark_tail { |
32
|
2
|
|
|
2
|
0
|
3
|
my $self = shift; |
33
|
2
|
|
|
|
|
3
|
$_->mark_tail(@_) for @{$self->{+CELLS}}; |
|
2
|
|
|
|
|
5
|
|
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
|
|
28
|
no strict 'refs'; |
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
75
|
|
43
|
|
|
|
|
|
|
*$meth = sub { |
44
|
105
|
|
|
105
|
|
119
|
my $self = shift; |
45
|
105
|
|
|
|
|
199
|
$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
|
|
|
|
|
228
|
|
51
|
|
|
|
|
|
|
*$meth = sub { |
52
|
2
|
|
|
2
|
|
4
|
my $self = shift; |
53
|
2
|
|
|
|
|
3
|
return max(map { $_->$meth } @{$self->{+CELLS}}); |
|
6
|
|
|
|
|
53
|
|
|
2
|
|
|
|
|
2
|
|
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub next { |
58
|
38
|
|
|
38
|
0
|
55
|
my $self = shift; |
59
|
38
|
|
|
|
|
44
|
my ($cw) = @_; |
60
|
|
|
|
|
|
|
|
61
|
38
|
|
|
|
|
43
|
while ($self->{+IDX} < @{$self->{+CELLS}}) { |
|
44
|
|
|
|
|
76
|
|
62
|
27
|
|
|
|
|
36
|
my $cell = $self->{+CELLS}->[$self->{+IDX}]; |
63
|
|
|
|
|
|
|
|
64
|
27
|
|
|
|
|
51
|
my $lw = $cell->border_left_width; |
65
|
27
|
|
|
|
|
119
|
my $rw = $cell->border_right_width; |
66
|
27
|
|
|
|
|
104
|
my $vw = $cw - $lw - $rw; |
67
|
27
|
|
|
|
|
48
|
my $it = $cell->break->next($vw); |
68
|
|
|
|
|
|
|
|
69
|
27
|
100
|
|
|
|
68
|
return ($it, $vw) if $it; |
70
|
6
|
|
|
|
|
9
|
$self->{+IDX}++; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
17
|
|
|
|
|
72
|
return; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
38
|
|
|
38
|
0
|
63
|
sub break { $_[0] } |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub reset { |
79
|
2
|
|
|
2
|
0
|
2
|
my $self = shift; |
80
|
2
|
|
|
|
|
4
|
$self->{+IDX} = 0; |
81
|
2
|
|
|
|
|
2
|
$_->reset for @{$self->{+CELLS}}; |
|
2
|
|
|
|
|
5
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |