line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookProps; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JANDREW'; |
3
|
14
|
|
|
14
|
|
62879
|
use version; our $VERSION = version->declare('v0.16.8'); |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
101
|
|
4
|
|
|
|
|
|
|
###LogSD warn "You uncovered internal logging statements for Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookProps-$VERSION"; |
5
|
|
|
|
|
|
|
|
6
|
14
|
|
|
14
|
|
1407
|
use Moose::Role; |
|
14
|
|
|
|
|
21
|
|
|
14
|
|
|
|
|
117
|
|
7
|
|
|
|
|
|
|
requires qw( |
8
|
|
|
|
|
|
|
current_node_parsed good_load close_the_file |
9
|
|
|
|
|
|
|
parse_element squash_node advance_element_position |
10
|
|
|
|
|
|
|
); |
11
|
14
|
|
|
14
|
|
52661
|
use Types::Standard qw( is_HashRef StrMatch Str ); |
|
14
|
|
|
|
|
21
|
|
|
14
|
|
|
|
|
132
|
|
12
|
|
|
|
|
|
|
###LogSD use Log::Shiras::Telephone; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#########1 Dispatch Tables 3#########4#########5#########6#########7#########8#########9 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $method_lookup = { |
17
|
|
|
|
|
|
|
'dc:creator' => '_set_creator', |
18
|
|
|
|
|
|
|
'cp:lastModifiedBy' => '_set_modified_by', |
19
|
|
|
|
|
|
|
'dcterms:created' => '_set_date_created', |
20
|
|
|
|
|
|
|
'dcterms:modified' => '_set_date_modified', |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#########1 Public Attributes 3#########4#########5#########6#########7#########8#########9 |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#########1 Public Methods 3#########4#########5#########6#########7#########8#########9 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub load_unique_bits{ |
30
|
17
|
|
|
17
|
1
|
38
|
my( $self, ) = @_; |
31
|
|
|
|
|
|
|
###LogSD my $phone = Log::Shiras::Telephone->new( name_space => |
32
|
|
|
|
|
|
|
###LogSD $self->get_all_space . '::_load_unique_bits', ); |
33
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'debug', message => [ |
34
|
|
|
|
|
|
|
###LogSD "Setting the WorkbookPropsInterface unique bits" ] ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# turn workbook properties into a hashref |
37
|
17
|
|
|
|
|
34
|
my( $result, $node_name, $node_level, $result_ref ); |
38
|
17
|
|
|
|
|
98
|
my $current_node = $self->current_node_parsed; |
39
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'trace', message =>[ |
40
|
|
|
|
|
|
|
###LogSD "The current node is:", $current_node ] ); |
41
|
17
|
50
|
|
|
|
76
|
if( (keys %$current_node)[0] eq 'cp:coreProperties' ){ |
42
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'trace', message =>[ |
43
|
|
|
|
|
|
|
###LogSD "Found the core properties node" ] ); |
44
|
17
|
|
|
|
|
25
|
$result = 2; |
45
|
17
|
|
|
|
|
29
|
$node_name = 'cp:coreProperties'; |
46
|
|
|
|
|
|
|
}else{ |
47
|
0
|
|
|
|
|
0
|
( $result, $node_name, $node_level, $result_ref ) = |
48
|
|
|
|
|
|
|
$self->advance_element_position( 'cp:coreProperties' ); |
49
|
|
|
|
|
|
|
} |
50
|
17
|
50
|
33
|
|
|
110
|
if( $result and $node_name eq 'cp:coreProperties' ){ |
51
|
17
|
|
|
|
|
105
|
my $properties = $self->squash_node( $self->parse_element ); |
52
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'trace', message =>[ |
53
|
|
|
|
|
|
|
###LogSD "The parsed properties are:", $properties ] ); |
54
|
17
|
|
|
|
|
71
|
for my $header ( keys %$properties ){ |
55
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'debug', message => [ |
56
|
|
|
|
|
|
|
###LogSD "processing header: $header" ] ); |
57
|
153
|
100
|
|
|
|
262
|
if( exists $method_lookup->{$header} ){ |
58
|
68
|
|
|
|
|
79
|
my $method = $method_lookup->{$header}; |
59
|
|
|
|
|
|
|
my $value = is_HashRef( $properties->{$header} ) ? |
60
|
68
|
100
|
|
|
|
128
|
$properties->{$header}->{raw_text} : $properties->{$header}; |
61
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'trace', message => [ |
62
|
|
|
|
|
|
|
###LogSD "Implementing -$method- with value: $value" ] ); |
63
|
68
|
|
|
|
|
2037
|
$self->$method( $value ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
17
|
|
|
|
|
486
|
$self->good_load( 1 ); |
67
|
|
|
|
|
|
|
}else{ |
68
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'warn', message =>[ "no cp:coreProperties found" ] ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'debug', message => [ |
72
|
|
|
|
|
|
|
###LogSD "Closing out the xml file" ] ); |
73
|
17
|
|
|
|
|
94
|
$self->close_the_file; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#########1 Private Attributes 3#########4#########5#########6#########7#########8#########9 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
has _file_creator =>( |
79
|
|
|
|
|
|
|
isa => Str, |
80
|
|
|
|
|
|
|
reader => 'get_creator', |
81
|
|
|
|
|
|
|
writer => '_set_creator', |
82
|
|
|
|
|
|
|
clearer => '_clear_creator', |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
has _file_modified_by =>( |
86
|
|
|
|
|
|
|
isa => Str, |
87
|
|
|
|
|
|
|
reader => 'get_modified_by', |
88
|
|
|
|
|
|
|
writer => '_set_modified_by', |
89
|
|
|
|
|
|
|
clearer => '_clear_modified_by', |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
has _file_date_created =>( |
93
|
|
|
|
|
|
|
isa => StrMatch[qr/^\d{4}\-\d{2}\-\d{2}/], |
94
|
|
|
|
|
|
|
reader => 'get_date_created', |
95
|
|
|
|
|
|
|
writer => '_set_date_created', |
96
|
|
|
|
|
|
|
clearer => '_clear_date_created', |
97
|
|
|
|
|
|
|
); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
has _file_date_modified =>( |
100
|
|
|
|
|
|
|
isa => StrMatch[qr/^\d{4}\-\d{2}\-\d{2}/], |
101
|
|
|
|
|
|
|
reader => 'get_date_modified', |
102
|
|
|
|
|
|
|
writer => '_set_date_modified', |
103
|
|
|
|
|
|
|
clearer => '_clear_date_modified', |
104
|
|
|
|
|
|
|
); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
#########1 Private Methods 3#########4#########5#########6#########7#########8#########9 |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
#########1 Phinish 3#########4#########5#########6#########7#########8#########9 |
111
|
|
|
|
|
|
|
|
112
|
14
|
|
|
14
|
|
12427
|
no Moose::Role; |
|
14
|
|
|
|
|
22
|
|
|
14
|
|
|
|
|
76
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
#########1 Documentation 3#########4#########5#########6#########7#########8#########9 |
116
|
|
|
|
|
|
|
__END__ |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 NAME |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookProps - Workbook docProps Zip file unique reader |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 SYNOPSIS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
#!/usr/bin/env perl |
125
|
|
|
|
|
|
|
use MooseX::ShortCut::BuildInstance qw( build_instance ); |
126
|
|
|
|
|
|
|
use Types::Standard qw( HashRef ); |
127
|
|
|
|
|
|
|
use Spreadsheet::Reader::ExcelXML::XMLReader; |
128
|
|
|
|
|
|
|
use Spreadsheet::Reader::ExcelXML::ZipReader::WorkbookProps; |
129
|
|
|
|
|
|
|
use Spreadsheet::Reader::ExcelXML::WorkbookPropsInterface; |
130
|
|
|
|
|
|
|
my $test_instance = build_instance( |
131
|
|
|
|
|
|
|
superclasses => ['Spreadsheet::Reader::ExcelXML::XMLReader'], |
132
|
|
|
|
|
|
|
package => 'WorkbookPropsInterface', |
133
|
|
|
|
|
|
|
add_roles_in_sequence =>[ |
134
|
|
|
|
|
|
|
'Spreadsheet::Reader::ExcelXML::XMLReader::WorkbookProps', |
135
|
|
|
|
|
|
|
'Spreadsheet::Reader::ExcelXML::WorkbookPropsInterface', |
136
|
|
|
|
|
|
|
], |
137
|
|
|
|
|
|
|
file => 't/test_files/docProps/core.xml', |
138
|
|
|
|
|
|
|
); |
139
|
|
|
|
|
|
|
print $test_instance->$get_date_created . "\n"; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
########################### |
142
|
|
|
|
|
|
|
# SYNOPSIS Screen Output |
143
|
|
|
|
|
|
|
# 01: 2013-11-10T08:27:01Z |
144
|
|
|
|
|
|
|
########################### |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 DESCRIPTION |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
This documentation is written to explain ways to use this module when writing your own |
149
|
|
|
|
|
|
|
excel parser. To use the general package for excel parsing out of the box please review |
150
|
|
|
|
|
|
|
the documentation for L<Workbooks|Spreadsheet::Reader::ExcelXML>, |
151
|
|
|
|
|
|
|
L<Worksheets|Spreadsheet::Reader::ExcelXML::Worksheet>, and |
152
|
|
|
|
|
|
|
L<Cells|Spreadsheet::Reader::ExcelXML::Cell> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This is the Zip based file adaptor for reading the workbook docProps data and then |
155
|
|
|
|
|
|
|
updating the general workbook metadata. The extracted data is accesible through |
156
|
|
|
|
|
|
|
L<Methods|/Methods>. The goal of this module is to standardize the outputs of this |
157
|
|
|
|
|
|
|
metadata from non standard inputs. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 Required Methods |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
These are the methods required by the role. A link to the default implementation of |
162
|
|
|
|
|
|
|
these methods is provided. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
L<Spreadsheet::Reader::ExcelXML::XMLReader/advance_element_position( $element, [$iterations] )> |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
L<Spreadsheet::Reader::ExcelXML::XMLReader/good_load( $state )> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
L<Spreadsheet::Reader::ExcelXML::XMLReader/close_the_file> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L<Spreadsheet::Reader::ExcelXML::XMLReader/parse_element( [$depth] )> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
L<Spreadsheet::Reader::ExcelXML::XMLReader/squash_node( $node )> |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head2 Methods |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
These are the methods provided by this role (only). |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head3 load_unique_bits |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=over |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
B<Definition:> This role is meant to run on top of L<Spreadsheet::Reader::ExcelXML::XMLReader>. |
183
|
|
|
|
|
|
|
When it does the reader will call this function as available when it first starts the file. |
184
|
|
|
|
|
|
|
Therefore this is where the unique Metadata for this file is found and stored. (in the |
185
|
|
|
|
|
|
|
attributes) |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
B<Accepts:> nothing |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
B<Returns:> nothing |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=back |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head3 get_creator |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=over |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
B<Definition:> This returns the string stored in the file by Excel for the file creator. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
B<Accepts:> nothing |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
B<Returns:> the creator identification string |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=back |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head3 get_modified_by |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=over |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
B<Definition:> This returns the string stored in the file by Excel for the last file |
210
|
|
|
|
|
|
|
modification entity. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
B<Accepts:> nothing |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
B<Returns:> the identification string for the last entity to modify the file |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=back |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head3 get_date_created |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=over |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
B<Definition:> returns the date string for when the file was created in Excel |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
B<Accepts:> nothing |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
B<Returns:> a date string |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=back |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head3 get_date_modified |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=over |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
B<Definition:> returns the date string for when the file was last modified in Excel |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
B<Accepts:> nothing |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
B<Returns:> a date string |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=back |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head1 SUPPORT |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=over |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
L<github Spreadsheet::Reader::ExcelXML/issues |
247
|
|
|
|
|
|
|
|https://github.com/jandrew/p5-spreadsheet-reader-excelxml/issues> |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=back |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head1 TODO |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=over |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
B<1.> Nothing currently |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=back |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head1 AUTHOR |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=over |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=item Jed Lund |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=item jandrew@cpan.org |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=back |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=head1 COPYRIGHT |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
This program is free software; you can redistribute |
272
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
The full text of the license can be found in the |
275
|
|
|
|
|
|
|
LICENSE file included with this module. |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
This software is copyrighted (c) 2016 by Jed Lund |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=over |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
L<Spreadsheet::Reader::ExcelXML> - the package |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=back |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=head1 SEE ALSO |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=over |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
L<Spreadsheet::Read> - generic Spreadsheet reader |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
L<Spreadsheet::ParseExcel> - Excel binary version 2003 and earlier (.xls files) |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
L<Spreadsheet::XLSX> - Excel version 2007 and later |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
L<Spreadsheet::ParseXLSX> - Excel version 2007 and later |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
L<Log::Shiras|https://github.com/jandrew/Log-Shiras> |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=over |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
All lines in this package that use Log::Shiras are commented out |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=back |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=back |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=cut |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
#########1#########2 main pod documentation end 5#########6#########7#########8#########9 |