line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tags::Output::Structure; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
78394
|
use base qw(Tags::Output); |
|
10
|
|
|
|
|
60
|
|
|
10
|
|
|
|
|
4146
|
|
4
|
10
|
|
|
10
|
|
327197
|
use strict; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
154
|
|
5
|
10
|
|
|
10
|
|
42
|
use warnings; |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
222
|
|
6
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
41
|
use Error::Pure qw(err); |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
951
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.08; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Flush. |
12
|
|
|
|
|
|
|
sub flush { |
13
|
20
|
|
|
20
|
1
|
1372
|
my ($self, $reset_flag) = @_; |
14
|
|
|
|
|
|
|
|
15
|
20
|
|
|
|
|
31
|
my $ouf = $self->{'output_handler'}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Text output. |
18
|
20
|
|
|
|
|
34
|
my $ret_ar; |
19
|
20
|
50
|
|
|
|
45
|
if ($ouf) { |
20
|
0
|
|
|
|
|
0
|
foreach my $line_ar (@{$self->{'flush_code'}}) { |
|
0
|
|
|
|
|
0
|
|
21
|
0
|
|
|
|
|
0
|
my $line = "['"; |
22
|
0
|
|
|
|
|
0
|
$line .= join "', '", @{$line_ar}; |
|
0
|
|
|
|
|
0
|
|
23
|
0
|
|
|
|
|
0
|
$line .= "']".$self->{'output_sep'}; |
24
|
10
|
|
|
10
|
|
59
|
no warnings; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
4570
|
|
25
|
0
|
0
|
|
|
|
0
|
print {$ouf} $line |
|
0
|
|
|
|
|
0
|
|
26
|
|
|
|
|
|
|
or err 'Cannot write to output handler.'; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Structure. |
30
|
|
|
|
|
|
|
} else { |
31
|
20
|
|
|
|
|
31
|
$ret_ar = $self->{'flush_code'}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Reset. |
35
|
20
|
100
|
|
|
|
50
|
if ($reset_flag) { |
36
|
1
|
|
|
|
|
3
|
$self->reset; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
20
|
|
|
|
|
59
|
return $ret_ar; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Attributes. |
43
|
|
|
|
|
|
|
sub _put_attribute { |
44
|
9
|
|
|
9
|
|
130
|
my ($self, $attr, $value) = @_; |
45
|
|
|
|
|
|
|
|
46
|
9
|
|
|
|
|
28
|
$self->_put_structure('a', $attr, $value); |
47
|
|
|
|
|
|
|
|
48
|
9
|
|
|
|
|
15
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Begin of tag. |
52
|
|
|
|
|
|
|
sub _put_begin_of_tag { |
53
|
15
|
|
|
15
|
|
10388
|
my ($self, $tag) = @_; |
54
|
|
|
|
|
|
|
|
55
|
15
|
|
|
|
|
33
|
$self->_put_structure('b', $tag); |
56
|
15
|
|
|
|
|
17
|
unshift @{$self->{'printed_tags'}}, $tag; |
|
15
|
|
|
|
|
29
|
|
57
|
|
|
|
|
|
|
|
58
|
15
|
|
|
|
|
27
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# CData. |
62
|
|
|
|
|
|
|
sub _put_cdata { |
63
|
1
|
|
|
1
|
|
149
|
my ($self, @cdata) = @_; |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
4
|
$self->_put_structure('cd', @cdata); |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
3
|
return; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Comment. |
71
|
|
|
|
|
|
|
sub _put_comment { |
72
|
4
|
|
|
4
|
|
1485
|
my ($self, @comments) = @_; |
73
|
|
|
|
|
|
|
|
74
|
4
|
|
|
|
|
13
|
$self->_put_structure('c', @comments); |
75
|
|
|
|
|
|
|
|
76
|
4
|
|
|
|
|
8
|
return; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# Data. |
80
|
|
|
|
|
|
|
sub _put_data { |
81
|
6
|
|
|
6
|
|
58
|
my ($self, @data) = @_; |
82
|
|
|
|
|
|
|
|
83
|
6
|
|
|
|
|
13
|
$self->_put_structure('d', @data); |
84
|
|
|
|
|
|
|
|
85
|
6
|
|
|
|
|
8
|
return; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# End of tag. |
89
|
|
|
|
|
|
|
sub _put_end_of_tag { |
90
|
15
|
|
|
15
|
|
226
|
my ($self, $tag) = @_; |
91
|
|
|
|
|
|
|
|
92
|
15
|
|
|
|
|
16
|
my $printed = shift @{$self->{'printed_tags'}}; |
|
15
|
|
|
|
|
41
|
|
93
|
15
|
100
|
|
|
|
36
|
if ($printed ne $tag) { |
94
|
1
|
|
|
|
|
6
|
err "Ending bad tag: '$tag' in block of tag '$printed'."; |
95
|
|
|
|
|
|
|
} |
96
|
14
|
|
|
|
|
28
|
$self->_put_structure('e', $tag); |
97
|
|
|
|
|
|
|
|
98
|
14
|
|
|
|
|
24
|
return; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# Instruction. |
102
|
|
|
|
|
|
|
sub _put_instruction { |
103
|
2
|
|
|
2
|
|
208
|
my ($self, $target, $code) = @_; |
104
|
|
|
|
|
|
|
|
105
|
2
|
|
|
|
|
6
|
my @instruction = ('i', $target); |
106
|
2
|
100
|
|
|
|
5
|
if ($code) { |
107
|
1
|
|
|
|
|
2
|
push @instruction, $code; |
108
|
|
|
|
|
|
|
} |
109
|
2
|
|
|
|
|
6
|
$self->_put_structure(@instruction); |
110
|
|
|
|
|
|
|
|
111
|
2
|
|
|
|
|
4
|
return; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# Raw data. |
115
|
|
|
|
|
|
|
sub _put_raw { |
116
|
1
|
|
|
1
|
|
159
|
my ($self, @raw_data) = @_; |
117
|
|
|
|
|
|
|
|
118
|
1
|
|
|
|
|
4
|
$self->_put_structure('r', @raw_data); |
119
|
|
|
|
|
|
|
|
120
|
1
|
|
|
|
|
2
|
return; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# Put common structure. |
124
|
|
|
|
|
|
|
sub _put_structure { |
125
|
52
|
|
|
52
|
|
94
|
my ($self, @struct) = @_; |
126
|
|
|
|
|
|
|
|
127
|
52
|
|
|
|
|
63
|
push @{$self->{'flush_code'}}, \@struct; |
|
52
|
|
|
|
|
91
|
|
128
|
|
|
|
|
|
|
|
129
|
52
|
|
|
|
|
73
|
return; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
__END__ |