line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
############################################################################### |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Relationships - A class for writing the Excel XLSX Rels file. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Used in conjunction with Excel::Writer::XLSX |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Copyright 2000-2021, John McNamara, jmcnamara@cpan.org |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# Documentation after __END__ |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# perltidy with the following options: -mbl=2 -pt=0 -nola |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use 5.008002; |
16
|
1124
|
|
|
1124
|
|
15567
|
use strict; |
|
1124
|
|
|
|
|
3420
|
|
17
|
1124
|
|
|
1124
|
|
4800
|
use warnings; |
|
1124
|
|
|
|
|
1930
|
|
|
1124
|
|
|
|
|
17061
|
|
18
|
1124
|
|
|
1124
|
|
4365
|
use Carp; |
|
1124
|
|
|
|
|
1989
|
|
|
1124
|
|
|
|
|
20281
|
|
19
|
1124
|
|
|
1124
|
|
4543
|
use Excel::Writer::XLSX::Package::XMLwriter; |
|
1124
|
|
|
|
|
1992
|
|
|
1124
|
|
|
|
|
48899
|
|
20
|
1124
|
|
|
1124
|
|
6296
|
|
|
1124
|
|
|
|
|
2282
|
|
|
1124
|
|
|
|
|
561989
|
|
21
|
|
|
|
|
|
|
our @ISA = qw(Excel::Writer::XLSX::Package::XMLwriter); |
22
|
|
|
|
|
|
|
our $VERSION = '1.09'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $schema_root = 'http://schemas.openxmlformats.org'; |
25
|
|
|
|
|
|
|
our $package_schema = $schema_root . '/package/2006/relationships'; |
26
|
|
|
|
|
|
|
our $document_schema = $schema_root . '/officeDocument/2006/relationships'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
############################################################################### |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
# Public and private API methods. |
31
|
|
|
|
|
|
|
# |
32
|
|
|
|
|
|
|
############################################################################### |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
############################################################################### |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
# new() |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
# Constructor. |
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $class = shift; |
43
|
|
|
|
|
|
|
my $fh = shift; |
44
|
2988
|
|
|
2988
|
0
|
7602
|
my $self = Excel::Writer::XLSX::Package::XMLwriter->new( $fh ); |
45
|
2988
|
|
|
|
|
4538
|
|
46
|
2988
|
|
|
|
|
10805
|
$self->{_rels} = []; |
47
|
|
|
|
|
|
|
$self->{_id} = 1; |
48
|
2988
|
|
|
|
|
6343
|
|
49
|
2988
|
|
|
|
|
5242
|
bless $self, $class; |
50
|
|
|
|
|
|
|
|
51
|
2988
|
|
|
|
|
4789
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
2988
|
|
|
|
|
5792
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
############################################################################### |
56
|
|
|
|
|
|
|
# |
57
|
|
|
|
|
|
|
# _assemble_xml_file() |
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
# Assemble and write the XML file. |
60
|
|
|
|
|
|
|
# |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $self = shift; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
$self->xml_declaration; |
65
|
2987
|
|
|
2987
|
|
5775
|
$self->_write_relationships(); |
66
|
|
|
|
|
|
|
} |
67
|
2987
|
|
|
|
|
12627
|
|
68
|
2987
|
|
|
|
|
9798
|
|
69
|
|
|
|
|
|
|
############################################################################### |
70
|
|
|
|
|
|
|
# |
71
|
|
|
|
|
|
|
# _add_document_relationship() |
72
|
|
|
|
|
|
|
# |
73
|
|
|
|
|
|
|
# Add container relationship to XLSX .rels xml files. |
74
|
|
|
|
|
|
|
# |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $self = shift; |
77
|
|
|
|
|
|
|
my $type = shift; |
78
|
|
|
|
|
|
|
my $target = shift; |
79
|
|
|
|
|
|
|
my $target_mode = shift; |
80
|
5476
|
|
|
5476
|
|
7837
|
|
81
|
5476
|
|
|
|
|
7410
|
$type = $document_schema . $type; |
82
|
5476
|
|
|
|
|
6944
|
|
83
|
5476
|
|
|
|
|
6443
|
push @{ $self->{_rels} }, [ $type, $target, $target_mode ]; |
84
|
|
|
|
|
|
|
} |
85
|
5476
|
|
|
|
|
11151
|
|
86
|
|
|
|
|
|
|
|
87
|
5476
|
|
|
|
|
7598
|
############################################################################### |
|
5476
|
|
|
|
|
19862
|
|
88
|
|
|
|
|
|
|
# |
89
|
|
|
|
|
|
|
# _add_package_relationship() |
90
|
|
|
|
|
|
|
# |
91
|
|
|
|
|
|
|
# Add container relationship to XLSX .rels xml files. |
92
|
|
|
|
|
|
|
# |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $self = shift; |
95
|
|
|
|
|
|
|
my $type = shift; |
96
|
|
|
|
|
|
|
my $target = shift; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
$type = $package_schema . $type; |
99
|
892
|
|
|
892
|
|
1734
|
|
100
|
892
|
|
|
|
|
1714
|
push @{ $self->{_rels} }, [ $type, $target ]; |
101
|
892
|
|
|
|
|
1579
|
} |
102
|
|
|
|
|
|
|
|
103
|
892
|
|
|
|
|
2564
|
|
104
|
|
|
|
|
|
|
############################################################################### |
105
|
892
|
|
|
|
|
1783
|
# |
|
892
|
|
|
|
|
2972
|
|
106
|
|
|
|
|
|
|
# _add_ms_package_relationship() |
107
|
|
|
|
|
|
|
# |
108
|
|
|
|
|
|
|
# Add container relationship to XLSX .rels xml files. Uses MS schema. |
109
|
|
|
|
|
|
|
# |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
my $self = shift; |
112
|
|
|
|
|
|
|
my $type = shift; |
113
|
|
|
|
|
|
|
my $target = shift; |
114
|
|
|
|
|
|
|
my $schema = 'http://schemas.microsoft.com/office/2006/relationships'; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
$type = $schema . $type; |
117
|
6
|
|
|
6
|
|
11
|
|
118
|
6
|
|
|
|
|
9
|
push @{ $self->{_rels} }, [ $type, $target ]; |
119
|
6
|
|
|
|
|
11
|
} |
120
|
6
|
|
|
|
|
9
|
|
121
|
|
|
|
|
|
|
|
122
|
6
|
|
|
|
|
16
|
############################################################################### |
123
|
|
|
|
|
|
|
# |
124
|
6
|
|
|
|
|
9
|
# _add_worksheet_relationship() |
|
6
|
|
|
|
|
19
|
|
125
|
|
|
|
|
|
|
# |
126
|
|
|
|
|
|
|
# Add worksheet relationship to sheet.rels xml files. |
127
|
|
|
|
|
|
|
# |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
my $self = shift; |
130
|
|
|
|
|
|
|
my $type = shift; |
131
|
|
|
|
|
|
|
my $target = shift; |
132
|
|
|
|
|
|
|
my $target_mode = shift; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$type = $document_schema . $type; |
135
|
|
|
|
|
|
|
|
136
|
769
|
|
|
769
|
|
1574
|
push @{ $self->{_rels} }, [ $type, $target, $target_mode ]; |
137
|
769
|
|
|
|
|
1518
|
} |
138
|
769
|
|
|
|
|
1390
|
|
139
|
769
|
|
|
|
|
1307
|
|
140
|
|
|
|
|
|
|
############################################################################### |
141
|
769
|
|
|
|
|
2245
|
# |
142
|
|
|
|
|
|
|
# Internal methods. |
143
|
769
|
|
|
|
|
1547
|
# |
|
769
|
|
|
|
|
3267
|
|
144
|
|
|
|
|
|
|
############################################################################### |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
############################################################################### |
148
|
|
|
|
|
|
|
# |
149
|
|
|
|
|
|
|
# XML writing methods. |
150
|
|
|
|
|
|
|
# |
151
|
|
|
|
|
|
|
############################################################################### |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
############################################################################## |
155
|
|
|
|
|
|
|
# |
156
|
|
|
|
|
|
|
# _write_relationships() |
157
|
|
|
|
|
|
|
# |
158
|
|
|
|
|
|
|
# Write the <Relationships> element. |
159
|
|
|
|
|
|
|
# |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
my $self = shift; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
my @attributes = ( 'xmlns' => $package_schema, ); |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
$self->xml_start_tag( 'Relationships', @attributes ); |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
for my $rel ( @{ $self->{_rels} } ) { |
168
|
|
|
|
|
|
|
$self->_write_relationship( @$rel ); |
169
|
2987
|
|
|
2987
|
|
5120
|
} |
170
|
|
|
|
|
|
|
|
171
|
2987
|
|
|
|
|
7487
|
$self->xml_end_tag( 'Relationships' ); |
172
|
|
|
|
|
|
|
|
173
|
2987
|
|
|
|
|
11133
|
# Close the XML writer filehandle. |
174
|
|
|
|
|
|
|
$self->xml_get_fh()->close(); |
175
|
2987
|
|
|
|
|
4861
|
} |
|
2987
|
|
|
|
|
6930
|
|
176
|
7143
|
|
|
|
|
14345
|
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
############################################################################## |
179
|
2987
|
|
|
|
|
10801
|
# |
180
|
|
|
|
|
|
|
# _write_relationship() |
181
|
|
|
|
|
|
|
# |
182
|
2987
|
|
|
|
|
8048
|
# Write the <Relationship> element. |
183
|
|
|
|
|
|
|
# |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
my $self = shift; |
186
|
|
|
|
|
|
|
my $type = shift; |
187
|
|
|
|
|
|
|
my $target = shift; |
188
|
|
|
|
|
|
|
my $target_mode = shift; |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
my @attributes = ( |
191
|
|
|
|
|
|
|
'Id' => 'rId' . $self->{_id}++, |
192
|
|
|
|
|
|
|
'Type' => $type, |
193
|
|
|
|
|
|
|
'Target' => $target, |
194
|
7143
|
|
|
7143
|
|
9707
|
); |
195
|
7143
|
|
|
|
|
9315
|
|
196
|
7143
|
|
|
|
|
8948
|
push @attributes, ( 'TargetMode' => $target_mode ) if $target_mode; |
197
|
7143
|
|
|
|
|
8826
|
|
198
|
|
|
|
|
|
|
$self->xml_empty_tag( 'Relationship', @attributes ); |
199
|
|
|
|
|
|
|
} |
200
|
7143
|
|
|
|
|
19101
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
1; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
|
205
|
7143
|
100
|
|
|
|
13784
|
|
206
|
|
|
|
|
|
|
=pod |
207
|
7143
|
|
|
|
|
16398
|
|
208
|
|
|
|
|
|
|
=head1 NAME |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Relationships - A class for writing the Excel XLSX Rels file. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head1 SYNOPSIS |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
See the documentation for L<Excel::Writer::XLSX>. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head1 DESCRIPTION |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
This module is used in conjunction with L<Excel::Writer::XLSX>. |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=head1 AUTHOR |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
John McNamara jmcnamara@cpan.org |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head1 COPYRIGHT |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
(c) MM-MMXXI, John McNamara. |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head1 LICENSE |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Either the Perl Artistic Licence L<http://dev.perl.org/licenses/artistic.html> or the GPL L<http://www.opensource.org/licenses/gpl-license.php>. |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
See the documentation for L<Excel::Writer::XLSX>. |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=cut |