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 Config.pm
. The variable name must be all uppercase. Variable values are actually array reference 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.
PUBLIC METHODS
config
my $config = XML::Template::Config->config ($configfile);
This method returns a hash containing the configuration information in the XML config file. 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 config file is named by the configuration variable $CONFIGFILE
.
See the documentation in xml-template.conf
for information on the format and contents of the config file.
load
XML::Template::Config->load ($module)
|| return $self->error (XML::Template::Config->error);
This method requires the module, $module
.
AUTHOR
Jonathan Waxman jowaxman@bbl.med.upenn.edu
COPYRIGHT
Copyright (c) 2002 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.