NAME

XML::Template::Base - Base class for XML::Template modules.

SYNOPSIS

use base qw(XML::Template::Base);
use XML::Template::Base;

DESCRIPTION

This module is the XML::Template base class. It implements common functionality for many other XML::Template modules, including construction and error handling.

CONSTRUCTOR

XML::Template::Base provides a common constructor for XML::Template modules. The constructor creates a new self and calls an initialization method. If the derived class does not have its own initialization subroutine, XML::Template::Base provides one that simply returns true.

The following named configuration parameters are supported:

Debug

Set to true to turn on printing debug information. Not really supported.

HTTPHost

The hostname of the requesting server. The default value is set to the environment variable HTTP_HOST. If this is not set (for instance, if running on the command line), the default is localhost.

Config

A reference to an XML::GDOME object that contains XML::Template configuration information. See XML::Template::Config.

PRIVATE METHODS

_init

XML::Template::Base provides an initialization function that simply returns 1. This is required for modules that use XML::Template::Base as a base class, but do not require an initialization function.

PUBLIC METHODS

error

return $self->error ($type, $error);
my ($type, $error) = $self->error;
print $self->error;

XML::Template::Base provides the method error to do simple error handling. If no parameters are given, the currently stored error type and message are returned. If parameters for the error type and message are given, they are stored as the current error.

error may be called as a package method (e.g., XML::Template::Module->error ($error); or as an object method (e.g., $xml_template->error ($error);. If it is called as a package method, the error is stored as a package variable. If it is called as an object method, the error is stored as a private variable.

get_info

my $host_info = $self->get_info ("/xml-template/hosts/host[\@name='$name']",
                                 'basedir', 'domain');  

This method returns a hash containing name/value pairs from the XML::Template configuration file. The first parameter is an XPath query that returns the XML subtree containing the desired configuration information. The remaining parameters name the child elements of the configuration subtree whose values you wish returned in the hash. This method is wrapped by more specific subroutines, for instance, get_host_info, get_subroutine_info, get_namespace_info, etc. See XML::Template::Config for more details on the XML::Template configuration file.

get_host_info

my $host_info = $self->get_host_info ($hostname);
my $host_info = $self->get_host_info ($hostname, 'domain');

This method returns a hash of name/value pairs of hostname information from the XML::Template configuration file. The first parameter is the name of the host for which information is desired. The remaining parameters name the configuration elements to include in the hash. If no such parameters are given, all host configuration elements are included. Currently, this includes basedir and domain.

get_source_mapping_info

my $get_source_mapping_info = $self->get_source_mapping_info (
                                namespace	=> $namespace);
my $get_source_mapping_info = $self->get_source_mapping_info (
                                namespace	=> $namespace,
                                'source');

This method returns a hash of name/value pairs of source mapping two parameters give the resource type and name of the source mapping for which information is desired. The remaining parameters name the configuration elements to include in the hash. If no such parameters are given, all source mapping configuration elements are included. Currently, this includes source, table, keys, and relation. The element relation is a hash of related namespace name/table pairs.

get_source_info

my $source_info = $self->get_source_info ($sourcename);
my $source_info = $self->get_source_info ($sourcename, 'module');

This method returns a hash of name/value pairs of source information from the XML::Template configuration file. The first parameter is the name of the source for which information is desired. The remaining parameters name the configuration elements to include in the hash. If no such parameters are given, all host configuration elements are included. Currently, this includes module, dsn, user, and pwdfile.

get_source

my $source = $self->get_source ($sourcename);

This method returns the data source named by the parameter from the XML::Template configuration file.

Data source references are stored in a cache. If a requested data source has already been loaded, the cached reference to it is returned.

get_subroutine_info

my $subroutine_info = $self->get_subroutine_info ($subname);
my $subroutine_info = $self->get_subroutine_info ($subname, 'module');

This method returns a hash of name/value pairs of subroutine information from the XML::Template configuration file. The first parameter is the name of the subroutine for which information is desired. The remaining parameters name the configuration elements to include in the hash. If no such parameters are given, all host configuration elements are included. Currently, this include description and module.

get_namespace_info

my $namespace_info = $self->get_namespace_info ($namespace);
my $namespace_info = $self->get_namespace_info ($namespace, 'title');

This method returns a hash of name/value pairs of namespace information from the XML::Template configuration file. The first parameter is the name of the namespace for which information is desired. The remaining parameters name the configuration elements to include in the hash. If no such parameters are given, all host configuration elements are included. Currently, this include prefix, title, decsritpion, and module.

get_element_info

my $element_info = $self->get_element_info ($namespace, $element);
my $element_info = $self->get_element_info ($namespace, $element,
                                            'content');

This method returns a hash of name/value pairs of element information from the XML::Template configuration file. The first two parameters, respectively, are the name of the namespace in which the element resides and the name of the element for which information is desired. The remaining parameters name the configuration elements to include in the hash. If no such parameters are given, all host configuration elements are included. Currently, this include content and nestedin.

get_attribs

my $attribs = $self->get_attribs ($namespace, $element, $attrib);

This method returns an array of attribute names for an element. The first parameter specifies the namespace in which the element resides. The second parameter is the name of the element.

get_attrib_info

my $attrib_info = $self->get_attrib_info ($namespace, $element, $attrib);
my $attrib_info = $self->get_attrib_info ($namespace, $element, $attrib,
                                          'parse');

This method returns a hash of name/value pairs of attribute information from the XML::Template configuration file. The first three parameters, respectively, are the namespace in which the associated element resides, the attribute's associated element, and the name of the attribute for which information is desired. The remaining parameters name the configuration elements to include in the hash. If no such parameters are given, all host configuration elements are included. Currently, this include requires, parse, parser, and type.

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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 61:

=back doesn't take any parameters, but you said =back 4