The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.

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.

email

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

XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

COPYRIGHT AND LICENSE

Copyright (C) 2014 Kevin L. Esteb

TThis is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.