Spreadsheet::XLSX::Reader::LibXML::Error - Moose class for remembering the last error
#!/usr/bin/env perl $|=1; use MooseX::ShortCut::BuildInstance qw( build_instance ); use Spreadsheet::XLSX::Reader::LibXML::Error; my $action = build_instance( add_attributes =>{ error_inst =>{ handles =>[ qw( error set_error clear_error set_warnings if_warn ) ], }, }, error_inst => Spreadsheet::XLSX::Reader::LibXML::Error->new( should_warn => 1,# 0 to turn off cluck when the error is set ), ); print $action->dump; $action->set_error( "You did something wrong" ); print $action->dump; print $action->error . "\n"; ############################################################################## # SYNOPSIS Screen Output # 01: $VAR1 = bless( { # 02: 'error_inst' => bless( { # 03: 'should_warn' => 1, # 04: 'log_space' => 'Spreadsheet::XLSX::Reader::LogSpace' # 04: }, 'Spreadsheet::XLSX::Reader::Error' ) # 05: }, 'ANONYMOUS_SHIRAS_MOOSE_CLASS_1' ); # 06: You did something wrong at ~~lib/Spreadsheet/XLSX/Reader/LibXML/Error.pm line 31. # 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 # 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 # 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 # 11: $VAR1 = bless( { # 12: 'error_inst' => bless( { # 13: 'should_warn' => 1, # 14: 'error_string' => 'You did something wrong' # 15: }, 'Spreadsheet::XLSX::Reader::Error' ) # 16: }, 'ANONYMOUS_SHIRAS_MOOSE_CLASS_1' ); # 17: You did something wrong ##############################################################################
This documentation is written to explain ways to use this module when writing your own excel parser. To use the general package for excel parsing out of the box please review the documentation for Workbooks, Worksheets, and Cells
This Moose class contains two attributes. It is intended to be used through (by) delegation in other classes. The first attribute is used to store the current error string. The second, is set to turn on or off pushing the error string to STDERR when the first attribute is (re)set.
Data passed to new when creating an instance. For modification of these attributes see the listed 'attribute methods'. For more information on attributes see Moose::Manual::Attributes.
Definition: This stores an error string for recall later.
Default undef (init_arg = undef)
Range any string (error objects with the 'as_string' or 'message' are auto coerced to a string)
attribute methods Methods provided to adjust this attribute
Definition: returns the currently stored error string
Definition: clears the currently stored error string
Definition: sets the attribute with $error_string.
Definition: This determines if the package will push any low level errors logged during processing to STDERR when they occur. (rather than just made available) It should be noted that failures that kill the package should push to STDERR by default. If your Excel sheet is malformed it can error without failing. Sometimes this package will handle those cases correctly and sometimes it wont. If you want to know more behind the scenes about the unexpected behaviour of the sheet then turn this attribute on.
Default 1 -> it will push to STDERR
Range Boolean values
Definition: Turn pushed warnings on or off
Definition: Returns the current setting of this attribute
Definition: This (the Error) class is capable of pulling the "longmess" in Carp for each error in order to understand what happened. If that is just too much you can change the behaviour
Default 1 -> it will pull the longmess (using Carp);
Definition: add the longmess to errors
github Spreadsheet::XLSX::Reader::LibXML/issues
1. get clases in this package to return error numbers and or error strings and then provide opportunity for this class to localize. 2. Get the @CARP_NOT section to work and skip most of the Moose level reporting
Jed Lund
jandrew@cpan.org
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
This software is copyrighted (c) 2014, 2015 by Jed Lund
version - 0.77
Moose
Carp - cluck
MooseX::StrictConstructor
MooseX::HasDefaults::RO
Types::Standard
Spreadsheet::XLSX::Reader::LibXML::Types - v0.34
Spreadsheet::ParseExcel - Excel 2003 and earlier
Spreadsheet::XLSX - 2007+
Spreadsheet::ParseXLSX - 2007+
Log::Shiras
All lines in this package that use Log::Shiras are commented out
To install Spreadsheet::XLSX::Reader::LibXML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Spreadsheet::XLSX::Reader::LibXML
CPAN shell
perl -MCPAN -e shell install Spreadsheet::XLSX::Reader::LibXML
For more information on module installation, please visit the detailed CPAN module installation guide.