XAS::System::Environment - The base environment for the XAS environment
Your program can use this module in the following fashion:
use XAS::System; $xas = XAS::System->module('environment'); $pidfile = $xas->pidfile; $logfile = $xas->logfile; printf("The XAS root is %s\n", $xas->root);
This module describes the base environment for XAS. It will provide a uniform description of the directory layout for perl programs within the XAS environemnt.
This method will initialize the base module. It parses the environment using the following variables:
The root of the directory structure.
The path for log files.
The path for pid files.
The base path for spool files.
The server where a STOMP enabled message queue is located.
The port that server is listening on.
The server where a SMTP based mail server resides.
The port it is listening on.
On Debian Linux these are defined in the etc/environment script, which is created on initial installation.
This method will return a pre-generated name for a log file. The name will be based on the programs name with a ".log" extension, along with the path to the XAS log file directory. Or you can store your own self generated log file name.
Example
$logfile = $xas->logfile; $xas->logfile("/some/path/mylogfile.log");
This method will return a pre-generated name for a pid file. The name will be based on the programs name with a ".pid" extension, along with the path to the XAS pid file directory. Or you can store your own self generated pid file name.
$pidfile = $xas->pidfile; $xas->pidfile("/some/path/myfile.pid");
This method will return a pre-generated name for a configuration file. The name will be based on the programs name with a ".ini" extension, along with the path to the XAS configuration file directory. Or you can store your own self generated configuration file name.
$inifile = $xas->cfgfile; $xas->cfgfile("/some/path/myfile.cfg");
This method will return the name of the message queue server. Or you can store a differant name for the server.
$mqserver = $xas->mqserver; $xas->mqserver('mq.example.com');
This method will return the port for the message queue server, or you store a differant port number for that server.
$mqport = $xas->mqport; $xas->mqport('61613');
This method will return the name of the mail server. Or you can store a differant name for the server.
$mxserver = $xas->mxserver; $xas->mxserver('mail.example.com');
This method will return the port for the mail server, or you store a differant port number for that server.
$mxport = $xas->mxport; $xas->mxport('25');
This accessor returns the currently defined path for this program.
This accessor returns the root directory of the XAS environment.
This accessor returns the bin directory of the XAS environment. The bin directory is used to place executable commands.
This accessor returns the sbin directory of the XAS environment. The sbin directory is used to place system level commands.
This accessor returns the log directory of the XAS environment.
This accessor returns the run directory of the XAS environment. The run directory is used to place pid files and other such files.
This accessor returns the etc directory of the XAS environment. Application configuration files should go into this directory.
This accessor returns the lib directory of the XAS environemnt. This directory is used to store supporting file for the enviroment.
This accessor returns the spool directory of the XAS environemnt. This directory is used to store spool files generated within the environment.
This accessor returns the tmp directory of the XAS environment. This directory is used to store temporary files.
This accessor returns the var directory of the XAS environment.
This accessor returns the local hostname.
This access returns the domain name of the local host.
This accessor returns the effective username of the current process.
XAS
Kevin L. Esteb, <kevin@kesteb.us>
Copyright (C) 2012 by 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.
To install XAS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XAS
CPAN shell
perl -MCPAN -e shell install XAS
For more information on module installation, please visit the detailed CPAN module installation guide.