NAME
XML::Template::Config - Configuration module for XML::Template modules.
SYNOPSIS
use base qw(XML::Template::Base);
use XML::Template::Base;
DESCRIPTION
This module is the XML::Template configuration module. It contains the default values of many configuration variables used by many XML::Template modules.
CONFIGURATION VARIABLES
Configuration variables and their default values are defined at the top of XML/Template/Config.pm
. The variable name must be all uppercase. Variable values are actually anonymous array tuples. The first element is the type of configuration variable (VAR
or PACKAGE
), and the second element is the value. For instance,
$CONFIGFILE = [VAR, '/usr/local/xml-template/xml-template.conf'];
$PROCESS = [PACKAGE, 'XML::Template::Process'];
A configuration variable value is obtained by a calls to an XML::Template::Config subroutine that has the same name as the configuration variable but is lowercase. For instance, to get the values of the configuration variables above,
my $configfile = XML::Template::Config->configfile;
my $process = XML::Template::Config->process (%params);
For configuration variables of the type VAR, the value is simply returned. If the type is PACKAGE, the module given by the configuration variable value is required, and an object is instantiated and returned. Parameters passed to the XML::Template::Config subroutine are passed to the module constructor.
General Configuration Variables
- BASEDIR
-
The base installation directory for XML::Template. This directory typically contains the system-wide configuration file, a directory containing the siteadmin templates, and other system-wide templates.
- ADMINDIR
-
The directory containing the siteadmin templates, typically
$BASEDIR/admin
. - CONFIGDIR
-
The directory containing the system-wide configuration file, typically
$BASEDIR
. - CONFIGFILE
-
The name of the system-wide configuration file, typically
xml-template.conf
. - HOSTNAME
-
The default name of the host if none is given.
XML::Template
Configuration Variables
- PROCESS
-
The default document processing module, typically XML::Template::Process.
XML::Template::Process Configuration Variables
- HANDLER
-
The name of default the SAX parser handler module, typically XML::Template::Parser.
- SUBROUTINE
-
The name of the default module that contains methods implementing XML::Template subroutines, typically XML::Template::Subroutine.
- CACHE
-
The default document memory caching module, typically XML::Template::Cache.
- FILE_CACHE
-
The default document file caching module, typically XML::Cache::File.
- VARS
-
The default module that implements XML::Template variables, typically XML::Template::Vars.
XML::Template::Cache Configuration Variables.
- CACHE_SLOTS
-
The size of the cache array.
XML::Template::Cache::File Configuration Variables
- CACHE_DIR
-
The directory where cached template document files are stored, typically
/tmp/xml-template
.
XML::Template::Parser Configuration Variables
- STRING
-
The default module that parses XML::Template strings (attribute values and content).
PUBLIC METHODS
config
my $config = XML::Template::Config->config ($configfile);
This method reference a reference to an XML parser object (currently a GDOME object) for the parsed XML::Template XML cofiguration document. The first call to config
loads the config file and stores it in the package global variable $CONFIG
. Subsequent calls to config
will simply return $CONFIG
.
An optional parameter may be given naming the config file. If no parameter is given, the system-wide configuration file is named by the configuration variable $CONFIGFILE
and is located in the directory specified by $CONFIGDIR
.
If the element basedir
is present in the host configuration for the current host, a host-specific configuration document is loaded from basedir
and its contents appended to the contents of the system-wide configuration.
load
XML::Template::Config->load ($module)
|| return $self->error (XML::Template::Config->error);
This method requires the module named by the parameter.
AUTHOR
Jonathan Waxman <jowaxman@bbl.med.upenn.edu>
COPYRIGHT
Copyright (c) 2002-2003 Jonathan A. Waxman All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.