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