line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Spreadsheet::XLSX::Reader::LibXML::Error; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JANDREW'; |
3
|
8
|
|
|
8
|
|
3309384
|
use version; our $VERSION = version->declare('v0.38.20'); |
|
8
|
|
|
|
|
2163
|
|
|
8
|
|
|
|
|
68
|
|
4
|
|
|
|
|
|
|
###LogSD warn "You uncovered internal logging statements for Spreadsheet::XLSX::Reader::LibXML::Error-$VERSION"; |
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
1719
|
use Moose; |
|
8
|
|
|
|
|
341924
|
|
|
8
|
|
|
|
|
58
|
|
7
|
8
|
|
|
8
|
|
54740
|
use Carp qw( cluck longmess ); |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
556
|
|
8
|
|
|
|
|
|
|
#~ our @CARP_NOT = qw( |
9
|
|
|
|
|
|
|
#~ Spreadsheet::XLSX::Reader::LibXML::Error |
10
|
|
|
|
|
|
|
#~ Class::MOP::Class |
11
|
|
|
|
|
|
|
#~ ); |
12
|
8
|
|
|
8
|
|
5293
|
use MooseX::StrictConstructor; |
|
8
|
|
|
|
|
200390
|
|
|
8
|
|
|
|
|
51
|
|
13
|
8
|
|
|
8
|
|
68746
|
use MooseX::HasDefaults::RO; |
|
8
|
|
|
|
|
48006
|
|
|
8
|
|
|
|
|
47
|
|
14
|
8
|
|
|
|
|
85
|
use Types::Standard qw( |
15
|
|
|
|
|
|
|
Str |
16
|
|
|
|
|
|
|
Bool |
17
|
8
|
|
|
8
|
|
72535
|
); |
|
8
|
|
|
|
|
67340
|
|
18
|
8
|
|
|
8
|
|
6348
|
use Devel::StackTrace; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
218
|
|
19
|
8
|
|
|
8
|
|
84
|
use lib '../../../../../lib',; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
72
|
|
20
|
8
|
|
|
8
|
|
6012
|
use Spreadsheet::XLSX::Reader::LibXML::Types qw( ErrorString ); |
|
8
|
|
|
|
|
69
|
|
|
8
|
|
|
|
|
136
|
|
21
|
|
|
|
|
|
|
###LogSD with 'Log::Shiras::LogSpace'; |
22
|
|
|
|
|
|
|
###LogSD use Log::Shiras::Telephone; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#########1 Public Attributes 3#########4#########5#########6#########7#########8#########9 |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has error_string =>( |
27
|
|
|
|
|
|
|
isa => ErrorString, |
28
|
|
|
|
|
|
|
clearer => 'clear_error', |
29
|
|
|
|
|
|
|
reader => 'error', |
30
|
|
|
|
|
|
|
writer => 'set_error', |
31
|
|
|
|
|
|
|
init_arg => undef, |
32
|
|
|
|
|
|
|
coerce => 1, |
33
|
|
|
|
|
|
|
trigger => sub{ |
34
|
|
|
|
|
|
|
my ( $self, $error ) = @_; |
35
|
|
|
|
|
|
|
###LogSD my $phone = Log::Shiras::Telephone->new( |
36
|
|
|
|
|
|
|
###LogSD name_space => $self->get_all_space . '::set_error', ); |
37
|
|
|
|
|
|
|
my $error_string; |
38
|
|
|
|
|
|
|
###LogSD $error_string = "In name_space: " . $self->get_all_space . "\n"; |
39
|
|
|
|
|
|
|
if( $self->spewing_longmess ){ |
40
|
|
|
|
|
|
|
$error_string .= longmess( $error ); |
41
|
|
|
|
|
|
|
}else{ |
42
|
|
|
|
|
|
|
$error_string .= $error; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'warn', message => [ $error_string . "\n------------------------------\n" ] ); |
45
|
|
|
|
|
|
|
if( $self->if_warn ){ |
46
|
|
|
|
|
|
|
warn "$error_string\n"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has should_warn =>( |
52
|
|
|
|
|
|
|
isa => Bool, |
53
|
|
|
|
|
|
|
default => 0, |
54
|
|
|
|
|
|
|
writer => 'set_warnings', |
55
|
|
|
|
|
|
|
reader => 'if_warn', |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has spew_longmess =>( |
59
|
|
|
|
|
|
|
isa => Bool, |
60
|
|
|
|
|
|
|
default => 1, |
61
|
|
|
|
|
|
|
writer => 'should_spew_longmess', |
62
|
|
|
|
|
|
|
reader => 'spewing_longmess', |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#########1 Public Methods 3#########4#########5#########6#########7#########8#########9 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#########1 Private Attributes 3#########4#########5#########6#########7#########8#########9 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#########1 Private Methods 3#########4#########5#########6#########7#########8#########9 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#########1 Phinish 3#########4#########5#########6#########7#########8#########9 |
78
|
|
|
|
|
|
|
|
79
|
8
|
|
|
8
|
|
10606
|
no Moose; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
72
|
|
80
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
#########1 Documentation 3#########4#########5#########6#########7#########8#########9 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 NAME |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Spreadsheet::XLSX::Reader::LibXML::Error - Moose class for remembering the last error |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 SYNOPSIS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#!/usr/bin/env perl |
95
|
|
|
|
|
|
|
$|=1; |
96
|
|
|
|
|
|
|
use MooseX::ShortCut::BuildInstance qw( build_instance ); |
97
|
|
|
|
|
|
|
use Spreadsheet::XLSX::Reader::LibXML::Error; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my $action = build_instance( |
100
|
|
|
|
|
|
|
add_attributes =>{ |
101
|
|
|
|
|
|
|
error_inst =>{ |
102
|
|
|
|
|
|
|
handles =>[ qw( error set_error clear_error set_warnings if_warn ) ], |
103
|
|
|
|
|
|
|
}, |
104
|
|
|
|
|
|
|
}, |
105
|
|
|
|
|
|
|
error_inst => Spreadsheet::XLSX::Reader::LibXML::Error->new( |
106
|
|
|
|
|
|
|
should_warn => 1,# 0 to turn off cluck when the error is set |
107
|
|
|
|
|
|
|
), |
108
|
|
|
|
|
|
|
); |
109
|
|
|
|
|
|
|
print $action->dump; |
110
|
|
|
|
|
|
|
$action->set_error( "You did something wrong" ); |
111
|
|
|
|
|
|
|
print $action->dump; |
112
|
|
|
|
|
|
|
print $action->error . "\n"; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
############################################################################## |
115
|
|
|
|
|
|
|
# SYNOPSIS Screen Output |
116
|
|
|
|
|
|
|
# 01: $VAR1 = bless( { |
117
|
|
|
|
|
|
|
# 02: 'error_inst' => bless( { |
118
|
|
|
|
|
|
|
# 03: 'should_warn' => 1, |
119
|
|
|
|
|
|
|
# 04: 'log_space' => 'Spreadsheet::XLSX::Reader::LogSpace' |
120
|
|
|
|
|
|
|
# 04: }, 'Spreadsheet::XLSX::Reader::Error' ) |
121
|
|
|
|
|
|
|
# 05: }, 'ANONYMOUS_SHIRAS_MOOSE_CLASS_1' ); |
122
|
|
|
|
|
|
|
# 06: You did something wrong at ~~lib/Spreadsheet/XLSX/Reader/LibXML/Error.pm line 31. |
123
|
|
|
|
|
|
|
# 08: Spreadsheet::XLSX::Reader::Error::__ANON__('Spreadsheet::XLSX::Reader::Error=HASH(0x45e818)', 'You did something wrong') called at writer Spreadsheet::XLSX::Reader::Error::set_error of attribute error_string (defined at ../lib/Spreadsheet/XLSX/Reader/Error.pm line 42) line 13 |
124
|
|
|
|
|
|
|
# 09: Spreadsheet::XLSX::Reader::Error::set_error('Spreadsheet::XLSX::Reader::Error'=HASH(0x45e818)', 'You did something wrong') called at C:/strawberry/perl/site/lib/Moose/Meta/Method/Delegation.pm line 110 |
125
|
|
|
|
|
|
|
# 10: ANONYMOUS_SHIRAS_MOOSE_CLASS_1::set_error('ANONYMOUS_SHIRAS_MOOSE_CLASS_1=HASH(0x45e890)', 'You did something wrong') called at error_example.pl line 18 |
126
|
|
|
|
|
|
|
# 11: $VAR1 = bless( { |
127
|
|
|
|
|
|
|
# 12: 'error_inst' => bless( { |
128
|
|
|
|
|
|
|
# 13: 'should_warn' => 1, |
129
|
|
|
|
|
|
|
# 14: 'error_string' => 'You did something wrong' |
130
|
|
|
|
|
|
|
# 15: }, 'Spreadsheet::XLSX::Reader::Error' ) |
131
|
|
|
|
|
|
|
# 16: }, 'ANONYMOUS_SHIRAS_MOOSE_CLASS_1' ); |
132
|
|
|
|
|
|
|
# 17: You did something wrong |
133
|
|
|
|
|
|
|
############################################################################## |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 DESCRIPTION |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This documentation is written to explain ways to use this module when writing your own excel |
138
|
|
|
|
|
|
|
parser. To use the general package for excel parsing out of the box please review the |
139
|
|
|
|
|
|
|
documentation for L<Workbooks|Spreadsheet::XLSX::Reader::LibXML>, |
140
|
|
|
|
|
|
|
L<Worksheets|Spreadsheet::XLSX::Reader::LibXML::Worksheet>, and |
141
|
|
|
|
|
|
|
L<Cells|Spreadsheet::XLSX::Reader::LibXML::Cell> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This L<Moose> class contains two L<attributes|Moose::Manual::Attributes>. It is intended |
144
|
|
|
|
|
|
|
to be used through (by) L<delegation|Moose::Manual::Delegation> in other classes. The first |
145
|
|
|
|
|
|
|
attribute is used to store the current error string. The second, is set to turn on or off |
146
|
|
|
|
|
|
|
pushing the error string to STDERR when the first attribute is (re)set. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 Attributes |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Data passed to new when creating an instance. For modification of |
151
|
|
|
|
|
|
|
these attributes see the listed 'attribute methods'. For more information on |
152
|
|
|
|
|
|
|
attributes see L<Moose::Manual::Attributes>. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head3 error_string |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=over |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
B<Definition:> This stores an error string for recall later. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
B<Default> undef (init_arg = undef) |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
B<Range> any string (error objects with the 'as_string' or 'message' are auto coerced to |
163
|
|
|
|
|
|
|
a string) |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
B<attribute methods> Methods provided to adjust this attribute |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=back |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head4 error |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=over |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
B<Definition:> returns the currently stored error string |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=back |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head4 clear_error |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=over |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
B<Definition:> clears the currently stored error string |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=back |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head4 set_error( $error_string ) |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=over |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
B<Definition:> sets the attribute with $error_string. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=back |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head3 should_warn |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=over |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
B<Definition:> This determines if the package will push any low level errors logged |
198
|
|
|
|
|
|
|
during processing to STDERR when they occur. (rather than just made available) It |
199
|
|
|
|
|
|
|
should be noted that failures that kill the package should push to STDERR by default. |
200
|
|
|
|
|
|
|
If your Excel sheet is malformed it can error without failing. Sometimes this package |
201
|
|
|
|
|
|
|
will handle those cases correctly and sometimes it wont. If you want to know more |
202
|
|
|
|
|
|
|
behind the scenes about the unexpected behaviour of the sheet then turn this attribute |
203
|
|
|
|
|
|
|
on. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
B<Default> 1 -> it will push to STDERR |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
B<Range> Boolean values |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
B<attribute methods> Methods provided to adjust this attribute |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=back |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head4 set_warnings( $bool ) |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=over |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
B<Definition:> Turn pushed warnings on or off |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=back |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head4 if_warn |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=over |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
B<Definition:> Returns the current setting of this attribute |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=back |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head3 spew_longmess |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=over |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
B<Definition:> This (the Error) class is capable of pulling the L<Carp/longmess> |
234
|
|
|
|
|
|
|
for each error in order to understand what happened. If that is just too much |
235
|
|
|
|
|
|
|
you can change the behaviour |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
B<Default> 1 -> it will pull the longmess (using Carp); |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
B<Range> Boolean values |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
B<attribute methods> Methods provided to adjust this attribute |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=back |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=head4 should_spew_longmess( $bool ) |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=over |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
B<Definition:> add the longmess to errors |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=back |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head4 spewing_longmess |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=over |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
B<Definition:> Returns the current setting of this attribute |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=back |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=head1 SUPPORT |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=over |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
L<github Spreadsheet::XLSX::Reader::LibXML/issues |
266
|
|
|
|
|
|
|
|https://github.com/jandrew/Spreadsheet-XLSX-Reader-LibXML/issues> |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=back |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head1 TODO |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=over |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
B<1.> get clases in this package to return error numbers and or error strings and |
275
|
|
|
|
|
|
|
then provide opportunity for this class to localize. |
276
|
|
|
|
|
|
|
B<2.> Get the @CARP_NOT section to work and skip most of the Moose level reporting |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=back |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=head1 AUTHOR |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=over |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
Jed Lund |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
jandrew@cpan.org |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=back |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=head1 COPYRIGHT |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
This program is free software; you can redistribute |
293
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
The full text of the license can be found in the |
296
|
|
|
|
|
|
|
LICENSE file included with this module. |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
This software is copyrighted (c) 2014, 2015 by Jed Lund |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=over |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
L<version> - 0.77 |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
L<Moose> |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
L<Carp> - cluck |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
L<MooseX::StrictConstructor> |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
L<MooseX::HasDefaults::RO> |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
L<Types::Standard> |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
L<Spreadsheet::XLSX::Reader::LibXML::Types> - v0.34 |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=back |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=head1 SEE ALSO |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=over |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
L<Spreadsheet::ParseExcel> - Excel 2003 and earlier |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
L<Spreadsheet::XLSX> - 2007+ |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
L<Spreadsheet::ParseXLSX> - 2007+ |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
L<Log::Shiras|https://github.com/jandrew/Log-Shiras> |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=over |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
All lines in this package that use Log::Shiras are commented out |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=back |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=back |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=cut |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
#########1#########2 main pod documentation end 5#########6#########7#########8#########9 |