The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XAS::System::Environment - The base environment for the XAS environment

SYNOPSIS

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);

DESCRIPTION

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.

METHODS

new

This method will initialize the base module. It parses the environment using the following variables:

XAS_ROOT

The root of the directory structure.

XAS_LOG

The path for log files.

XAS_RUN

The path for pid files.

XAS_SPOOL

The base path for spool files.

XAS_MQSERVER

The server where a STOMP enabled message queue is located.

XAS_MQPORT

The port that server is listening on.

XAS_MXSERVER

The server where a SMTP based mail server resides.

XAS_MXPORT

The port it is listening on.

On Debian Linux these are defined in the etc/environment script, which is created on initial installation.

logfile

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");

pidfile

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.

Example

    $pidfile = $xas->pidfile;
    $xas->pidfile("/some/path/myfile.pid");

cfgfile

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.

Example

    $inifile = $xas->cfgfile;
    $xas->cfgfile("/some/path/myfile.cfg");

mqserver

This method will return the name of the message queue server. Or you can store a differant name for the server.

Example

    $mqserver = $xas->mqserver;
    $xas->mqserver('mq.example.com');

mqport

This method will return the port for the message queue server, or you store a differant port number for that server.

Example

    $mqport = $xas->mqport;
    $xas->mqport('61613');

mxserver

This method will return the name of the mail server. Or you can store a differant name for the server.

Example

    $mxserver = $xas->mxserver;
    $xas->mxserver('mail.example.com');

mxport

This method will return the port for the mail server, or you store a differant port number for that server.

Example

    $mxport = $xas->mxport;
    $xas->mxport('25');

ACCESSORS

path

This accessor returns the currently defined path for this program.

root

This accessor returns the root directory of the XAS environment.

bin

This accessor returns the bin directory of the XAS environment. The bin directory is used to place executable commands.

sbin

This accessor returns the sbin directory of the XAS environment. The sbin directory is used to place system level commands.

log

This accessor returns the log directory of the XAS environment.

run

This accessor returns the run directory of the XAS environment. The run directory is used to place pid files and other such files.

etc

This accessor returns the etc directory of the XAS environment. Application configuration files should go into this directory.

lib

This accessor returns the lib directory of the XAS environemnt. This directory is used to store supporting file for the enviroment.

spool

This accessor returns the spool directory of the XAS environemnt. This directory is used to store spool files generated within the environment.

tmp

This accessor returns the tmp directory of the XAS environment. This directory is used to store temporary files.

var

This accessor returns the var directory of the XAS environment.

host

This accessor returns the local hostname.

domain

This access returns the domain name of the local host.

username

This accessor returns the effective username of the current process.

SEE ALSO

XAS

AUTHOR

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

COPYRIGHT AND LICENSE

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.