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