NAME
XAS::Base - The base class for the XAS environment
SYNOPSIS
use XAS::Class
version => '0.01',
base => 'XAS::Base',
vars => {
PARAMS => {}
}
;
DESCRIPTION
This module defines a base class for the XAS Environment and inherits from Badger::Base. The package variable $PARAMS is used to hold the parameters that this class uses for initialization. Due to the pseudo inheritance of package variables provided by Badger::Class, these parameters can be changed or extended by inheriting classes. The parameters are validated using Params::Validate. Any parameters defined in $PARAMS auto-magically become accessors toward their values.
METHODS
new($parameters)
This is used to initialized the class. These parameters are validated using the validate_params() method.
By default the parameter -xdebug is set to 0. This parameter is used to turn on debugging output.
load_msgs
This method loads the message files. It searches @INC for the XAS installation. When found, it loads any message files found into the package variable MESSAGES. A message file has the following format:
[messages]
exception = %s: %s
Where "exception" is the name of the message and rest is the text that will be used for the message.
validate_params($params, $spec, $class)
This method is used to validate parameters. Internally this uses Params::Validate::validate_with() for the parameter validation.
By convention, all named parameters have a leading dash. This method will strip off that dash and lower case the parameters name.
If an validation exception is thrown, the parameter name will have the dash stripped.
Based on the $spec, this can return an array or a hashref of validated parameters and values.
- $params
-
An array ref to a set of parameters.
- $spec
-
A validation spec as defined by Params::Validate.
- $class
-
An optional class that is calling this method. If one is not provided then caller() is used to determine the calling method.
validation_exception($param, $class)
This is a package level sub routine. It exists to provide a uniform exception error message. It takes these parameters:
- $param
-
The error message returned by Params::Validate.
- $class
-
The routine that the error occurred in.
AUTOLOADING
Specific modules can be auto-loaded when a method name is invoked. The following methods have been defined:
alert
This will auto-load XAS::Lib::Modules::Alerts. Please see that module for more details.
env
This will auto-load XAS::Lib::Modules::Environment. Please see that module for more details.
This will auto load XAS::Lib::Modules::Email. Please see that module for more details.
log
This will auto load XAS::Lib::Modules::Log. Please see that module for more details.
SEE ALSO
AUTHOR
Kevin L. Esteb, <kevin@kesteb.us>
COPYRIGHT AND LICENSE
Copyright (C) 2014 Kevin L. Esteb
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
See http://dev.perl.org/licenses/ for more information.