NAME
PTools::Global - PTools Framework for Local and Global variables
VERSION
This document describes version 0.18, released October, 2004.
SYNOPSIS
use '/opt/tools/<AppSubDir>/lib';
use PTools::Local;
$attrValue = PTools::Local->param( 'AttributeName' );
or $attrValue = PTools::Local->get( 'AttributeName' );
PTools::Local->set( 'AttributeName', $attrValue );
PTools::Local->reset( 'AttributeName' );
$dirPath = PTools::Local->path( 'PathAttribute' );
or $fullPath = PTools::Local->path( 'PathAttribute', 'filename.ext' );
or $fullPath = PTools::Local->path( 'PathAttribute', 'extra/path/filename.ext' );
PTools::Local->resetAppVariables();
PTools::Local->resetVariables();
$basename = PTools::Local->getBasename();
$dirname = PTools::Local->getDirname();
$hostname = PTools::Local->getHostname();
$domain = PTools::Local->getDomain();
$fqdn = PTools::Local->getFqdn();
or ($host,$domain) = PTools::Local->getFqdn();
PTools::Local->cgiRequired(); # abort w/messge if not in CGI BIN context
DESCRIPTION
This module is not intended to be used directly. It should be implicitly used via an application's PTools::Local module as shown above.
This PTools::Global module is a component of the Perl Tools Framework that provides a mechanism for maintaining and resetting some or all of the necessary 'script local' and 'application global' variables.
This provides a deceptively simple mechanism that allows for completely 'relocatable' Perl scripts. I.e., scripts that rely on the methods in an application's PTools::Local module to generate file system paths will almost never need to change if/when they are moved to an entirely different directory subtree (assuming, of course, that all the related subdirectories remain in the relative position).
Constructor
A constructor is provided for convenience; however, all methods are designed for use as class methods.
$localObj = new PTools::Local;
Methods
See PTools::Local for a description of the available methods.
Global Attributes
The following attributes (or Variables) are provided by the PTools::Global module. Note that the attribute names are not case sensitive.
Layout of GLOBAL specific directories.
Directory path Variable Description
-------------------- -------- ----------------------------------
tools/ TOPDIR Common subdir, could be "apps," whatever
global/ PATH Root for global; for dir name use DIR
* bin/ BINDIR Scripts and binary files
bin/util/ BINUTL Utility scripts and binary files
conf/ CFGDIR Configuration files
data/ DATDIR Data subdirectories
data/logs LOGDIR Log subdirectory
data/queue QUEDIR Data queues (ad hoc)
data/tmp TMPDIR Temporary files
data/xml XMLDIR XML data files
doc/ DOCDIR Private documents
* lib/ LIBDIR Library files
lib/util/ LIBUTL Library utilities
man/ MANDIR Manual pages
src/ SRCDIR Source for Binary files
src/util/ SRCUTL Source for Binary utilities
webcgi/ CGIDIR CGI subdirectories; for URL use CGIURL
webcgi/util/ CGIUTL CGI utilities
webdoc/ WEBDOC Public documents; for URL use WEBURL
webdoc/images IMGDIR Web images; for URL use IMGURL
webdoc/DTD DTDDIR DTD specs; for URL use DTDURL
webdoc/index.html Default welcome page
* = required subdirectories ... all others are optional
(the only required module in "lib" is "Local.pm")
INHERITANCE
The PTools::Local class inherits from this PTools::Global abstract base class.
SEE ALSO
See PTools::Local.
In addition, general documention about the Perl Tools Framework is available.
See http://www.ccobb.net/ptools/.
AUTHOR
Chris Cobb [no dot spam at ccobb dot net]
COPYRIGHT
Copyright (c) 1997-2007 by Chris Cobb. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.