NAME

Spreadsheet::XLSX::Reader::LibXML::Error - Moose class for remembering the last error

DESCRIPTION

This Moose class contains two attributes. The first is used to store the current error string. The second, is set to turn on or off pushing the error string to STDERR.

SYNOPSIS

	#!perl
	$|=1;
	use MooseX::ShortCut::BuildInstance qw( build_instance );
	use Spreadsheet::XLSX::Reader::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::Error->new(
				should_warn => 1,
				# should_warn => 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 line 19
 	# 07: at ../lib/Spreadsheet/XLSX/Reader/Error.pm line 28.
	# 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 28) line 9
 	# 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 19
 	# 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
	##############################################################################

Attributes

Data passed to new when creating an instance (parser). For modification of these attributes see the listed "Methods" of the instance.

error_string

    Definition: This stores the most recent error string for recall later. It also provides a link to debug logging as needed.

    Default undef (init_arg = undef)

    Range any string

should_warn

    Definition: This determines if the package will cluck and return a stack trace when the error_string attribute is set.

    Default 1 -> it will cluck

    Range Bool

Methods

These include methods to adjust attributes.

set_warnings( $bool )

    Definition: Turn clucked warnings on or off

    Accepts: Boolean values

    Returns: nothing

if_warn

    Definition: Check the current should_warn attribute value

    Accepts: Nothing

    Returns: $bool representing the current should_warn attribute value

error

    Definition: Returns the currently stored error string

    Accepts: Nothing

    Returns: $error representing the current error_string attribute value

set_error( $error_string )

    Definition: method to set (update) the current error string

    Accepts: $error_string

    Returns: Nothing

clear_error

    Definition: method to clear the current error string

    Accepts: Nothing

    Returns: Nothing (string is cleared)

SUPPORT

TODO

    1. Nothing yet

AUTHOR

Jed Lund
jandrew@cpan.org

COPYRIGHT

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 by Jed Lund

DEPENDENCIES

SEE ALSO