| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTML::FormatTableRow; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
HTML::FormatTableRow - Format HTML Table row |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require HTML::FormatTableRow; |
|
10
|
|
|
|
|
|
|
@ISA = qw(HTML::FormatTableRow); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
The HTML::FormatTableRow is used to record information and process |
|
15
|
|
|
|
|
|
|
a table row. This is a base class. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
The following attributes are supported: |
|
18
|
|
|
|
|
|
|
align: 'left','center', or 'right' alignment of table row entries |
|
19
|
|
|
|
|
|
|
valign: vertical alignment, 'top' or 'middle' |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 METHODS |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
require 5.004; |
|
26
|
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
33
|
|
|
28
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
581
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 $table_row = new HTML::FormatTableRow(%attr); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
The following attributes are supported: |
|
33
|
|
|
|
|
|
|
align: 'left','center', or 'right' alignment of table row entries |
|
34
|
|
|
|
|
|
|
valign: vertical alignment, 'top' or 'middle' |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
|
39
|
1
|
|
|
1
|
1
|
12
|
my($class, %attr) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
1
|
|
50
|
|
|
13
|
my $self = bless { |
|
|
|
|
50
|
|
|
|
|
|
42
|
|
|
|
|
|
|
align => $attr{'align'} || 'left', |
|
43
|
|
|
|
|
|
|
valign => $attr{'valign'} || 'middle', |
|
44
|
|
|
|
|
|
|
current_cell => undef, |
|
45
|
|
|
|
|
|
|
ended => 1, |
|
46
|
|
|
|
|
|
|
cells => [], |
|
47
|
|
|
|
|
|
|
}, $class; |
|
48
|
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
3
|
return $self; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 $table_row->add_element(%attr); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Add table element - should be subclassed. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub add_element { |
|
59
|
0
|
|
|
0
|
1
|
0
|
my($self, %attr) = @_; |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
0
|
croak "Should be subclassed.\n"; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 $table_row->end_element(); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
End table element - should be subclassed. |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub end_element { |
|
72
|
0
|
|
|
0
|
1
|
0
|
my($self) = @_; |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
0
|
croak "Should be subclassed.\n"; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 $table_row->add_text($text); |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Add text to cell. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub add_text { |
|
84
|
2
|
|
|
2
|
1
|
14
|
my($self, $text) = @_; |
|
85
|
|
|
|
|
|
|
|
|
86
|
2
|
50
|
|
|
|
7
|
if($self->{'ended'} != 0) { |
|
87
|
0
|
|
|
|
|
0
|
return; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
2
|
|
|
|
|
3
|
my $cell = $self->{'current_cell'}; |
|
91
|
2
|
50
|
|
|
|
6
|
if(defined($cell)) { |
|
92
|
2
|
|
|
|
|
8
|
$cell->add_text($text); |
|
93
|
|
|
|
|
|
|
} else { |
|
94
|
0
|
|
|
|
|
0
|
return 0; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 $table_row->text(); |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Return text associated with current table cell. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub text { |
|
105
|
1
|
|
|
1
|
1
|
22
|
my($self) = @_; |
|
106
|
|
|
|
|
|
|
|
|
107
|
1
|
|
|
|
|
3
|
my $cell = $self->{'current_cell'}; |
|
108
|
1
|
50
|
|
|
|
4
|
if(defined($cell)) { |
|
109
|
1
|
|
|
|
|
5
|
return $cell->text(); |
|
110
|
|
|
|
|
|
|
} else { |
|
111
|
0
|
|
|
|
|
|
return 0; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 $table_row->widths($final, $array_ref); |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
push the array of cell widths (in characters) |
|
118
|
|
|
|
|
|
|
onto the array specified using the array reference $array_ref. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub widths { |
|
123
|
0
|
|
|
0
|
1
|
|
my($self, $final, $array_ref) = @_; |
|
124
|
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
my @widths; |
|
126
|
|
|
|
|
|
|
my $cell; |
|
127
|
0
|
|
|
|
|
|
foreach $cell ( @{ $self->{'cells'} }) { |
|
|
0
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
push(@widths, $cell->width()); |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
$cell = $self->{'current_cell'}; |
|
132
|
0
|
0
|
|
|
|
|
if(defined($cell)) { |
|
133
|
0
|
|
|
|
|
|
push(@widths, $cell->width()); |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
push(@$array_ref, [ @widths ]); |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 $table_row->output($final, $formatter, $tab); |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Output the row data using the $formatter to do the output, |
|
142
|
|
|
|
|
|
|
and separating each cell using the $tab character. $final is not used. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub output { |
|
147
|
0
|
|
|
0
|
1
|
|
my($self, $final, $formatter, $tab) = @_; |
|
148
|
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
my $cell; |
|
150
|
0
|
|
|
|
|
|
foreach $cell ( @{ $self->{'cells'} }) { |
|
|
0
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
$cell->output($formatter); |
|
152
|
0
|
|
|
|
|
|
$formatter->out("$tab"); |
|
153
|
|
|
|
|
|
|
} |
|
154
|
|
|
|
|
|
|
|
|
155
|
0
|
0
|
|
|
|
|
if(defined($self->{'current_cell'})) { |
|
156
|
0
|
|
|
|
|
|
$self->{'current_cell'}->output($formatter); |
|
157
|
|
|
|
|
|
|
} |
|
158
|
0
|
|
|
|
|
|
$formatter->out("\n.sp\n"); |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
L |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Copyright (c) 1997 Frederick Hirsch. All rights reserved. |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or |
|
170
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 AUTHOR |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Frederick Hirsch |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=cut |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|