line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::TableContent::Table::Row; |
2
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
147
|
use Moo; |
|
20
|
|
|
|
|
43
|
|
|
20
|
|
|
|
|
119
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
6
|
|
|
|
|
|
|
|
7
|
20
|
|
|
20
|
|
6347
|
use HTML::TableContent::Table::Header; |
|
20
|
|
|
|
|
56
|
|
|
20
|
|
|
|
|
436
|
|
8
|
20
|
|
|
20
|
|
97
|
use HTML::TableContent::Table::Row::Cell; |
|
20
|
|
|
|
|
45
|
|
|
20
|
|
|
|
|
18059
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'HTML::TableContent::Element'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has cells => ( |
13
|
|
|
|
|
|
|
is => 'rw', |
14
|
|
|
|
|
|
|
lazy => 1, |
15
|
|
|
|
|
|
|
default => sub { [] }, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has header => ( |
19
|
|
|
|
|
|
|
is => 'rw', |
20
|
|
|
|
|
|
|
lazy => 1, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has '+html_tag' => ( |
24
|
|
|
|
|
|
|
default => 'tr', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
around raw => sub { |
28
|
|
|
|
|
|
|
my ( $orig, $self ) = ( shift, shift ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $row = $self->$orig(@_); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my @cells = map { $_->raw } $self->all_cells; |
33
|
|
|
|
|
|
|
$row->{cells} = \@cells; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return $row; |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
around has_nested => sub { |
39
|
|
|
|
|
|
|
my ( $orig, $self ) = ( shift, shift ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $nested = $self->$orig(@_); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
foreach my $cell ( $self->all_cells ) { |
44
|
|
|
|
|
|
|
if ( $cell->has_nested ) { |
45
|
|
|
|
|
|
|
$nested = 1; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
return $nested; |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub hash { |
53
|
43
|
|
|
43
|
0
|
2420
|
my $hash = { }; |
54
|
43
|
|
|
|
|
91
|
map { $hash->{$_->header->text} = $_->text } $_[0]->all_cells; |
|
117
|
|
|
|
|
468
|
|
55
|
43
|
|
|
|
|
126
|
return $hash; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub array { |
59
|
47
|
|
|
47
|
0
|
159
|
my @row = map { $_->text } $_[0]->all_cells; |
|
129
|
|
|
|
|
550
|
|
60
|
47
|
|
|
|
|
164
|
return @row; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub add_header { |
64
|
0
|
|
|
0
|
0
|
0
|
my $header = HTML::TableContent::Table::Header->new($_[1]); |
65
|
0
|
|
|
|
|
0
|
$_[0]->header($header); |
66
|
0
|
|
|
|
|
0
|
return $header; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub add_cell { |
70
|
5283
|
|
|
5283
|
1
|
98858
|
my $cell = HTML::TableContent::Table::Row::Cell->new($_[1]); |
71
|
5283
|
|
|
|
|
31765
|
push @{ $_[0]->cells }, $cell; |
|
5283
|
|
|
|
|
82038
|
|
72
|
5283
|
|
|
|
|
27834
|
return $cell; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
6254
|
|
|
6254
|
1
|
70591
|
sub cell_count { return scalar @{ $_[0]->cells }; } |
|
6254
|
|
|
|
|
95173
|
|
76
|
|
|
|
|
|
|
|
77
|
725
|
|
|
725
|
1
|
1103
|
sub all_cells { return @{ $_[0]->cells }; } |
|
725
|
|
|
|
|
11802
|
|
78
|
|
|
|
|
|
|
|
79
|
320
|
|
|
320
|
1
|
15196
|
sub get_cell { return $_[0]->cells->[ $_[1] ]; } |
80
|
|
|
|
|
|
|
|
81
|
147
|
|
|
147
|
1
|
39360
|
sub get_first_cell { return $_[0]->get_cell(0); } |
82
|
|
|
|
|
|
|
|
83
|
122
|
|
|
122
|
1
|
28293
|
sub get_last_cell { return $_[0]->get_cell( $_[0]->cell_count - 1 ); } |
84
|
|
|
|
|
|
|
|
85
|
64
|
|
|
64
|
1
|
737
|
sub clear_cell { return splice @{ $_[0]->cells }, $_[1], 1; } |
|
64
|
|
|
|
|
935
|
|
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
1
|
1
|
639
|
sub clear_first_cell { return shift @{ $_[0]->cells }; } |
|
1
|
|
|
|
|
25
|
|
88
|
|
|
|
|
|
|
|
89
|
1
|
|
|
1
|
1
|
645
|
sub clear_last_cell { return $_[0]->clear_cell( $_[0]->cell_count - 1 ); } |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _filter_headers { |
92
|
130
|
|
|
130
|
|
242
|
my ( $self, $headers ) = @_; |
93
|
130
|
|
|
|
|
207
|
my $cells = []; |
94
|
130
|
|
|
|
|
253
|
foreach my $cell ( $self->all_cells ) { |
95
|
356
|
|
|
|
|
1090
|
for ( @{$headers} ) { |
|
356
|
|
|
|
|
605
|
|
96
|
686
|
100
|
|
|
|
1489
|
if ( $cell->header->text eq $_->text ) { |
97
|
244
|
|
|
|
|
343
|
push @{$cells}, $cell; |
|
244
|
|
|
|
|
535
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
} |
101
|
130
|
|
|
|
|
2079
|
return $self->cells($cells); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub _render_element { |
105
|
147
|
|
|
147
|
|
415
|
my @cells = map { $_->render } $_[0]->all_cells; |
|
426
|
|
|
|
|
1884
|
|
106
|
147
|
|
|
|
|
547
|
my $cell = sprintf '%s' x @cells, @cells; |
107
|
147
|
|
|
|
|
440
|
return $cell; |
108
|
|
|
|
|
|
|
}; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |