Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Template::Config

Name Template::Config
Version 2.75
Located at /usr/lib64/perl5/vendor_perl
File /usr/lib64/perl5/vendor_perl/Template/Config.pm
Is Core No
Search CPAN for this module Template::Config
Documentation Template::Config
Module Details Template::Config

NAME

Template::Config - Factory module for instantiating other TT2 modules


SYNOPSIS

    use Template::Config;


DESCRIPTION

This module implements various methods for loading and instantiating other modules that comprise the Template Toolkit. It provides a consistent way to create toolkit components and allows custom modules to be used in place of the regular ones.

Package variables such as $STASH, $SERVICE, $CONTEXT, etc., contain the default module/package name for each component (the Template::Stash manpage, the Template::Service manpage and the Template::Context manpage, respectively) and are used by the various factory methods (stash(), service() and context()) to load the appropriate module. Changing these package variables will cause subsequent calls to the relevant factory method to load and instantiate an object from the new class.


PUBLIC METHODS

load($module)

Load a module using Perl's require(). Any occurrences of '::' in the module name are be converted to '/', and '.pm' is appended. Returns 1 on success or undef on error. Use $class->error() to examine the error string.

preload()

This method preloads all the other Template::* modules that are likely to be used. It is called automatically by the Template module when running under mod_perl ($ENV{MOD_PERL} is set).

parser(\%config)

Instantiate a new parser object of the class whose name is denoted by the package variable $PARSER (default: the Template::Parser manpage). Returns a reference to a newly instantiated parser object or undef on error.

provider(\%config)

Instantiate a new template provider object (default: the Template::Provider manpage). Returns an object reference or undef on error, as above.

plugins(\%config)

Instantiate a new plugins provider object (default: the Template::Plugins manpage). Returns an object reference or undef on error, as above.

filters(\%config)

Instantiate a new filter provider object (default: the Template::Filters manpage). Returns an object reference or undef on error, as above.

stash(\%vars)

Instantiate a new stash object (the Template::Stash manpage or the Template::Stash::XS manpage depending on the default set at installation time) using the contents of the optional hash array passed by parameter as initial variable definitions. Returns an object reference or undef on error, as above.

context(\%config)

Instantiate a new template context object (default: the Template::Context manpage). Returns an object reference or undef on error, as above.

service(\%config)

Instantiate a new template service object (default: the Template::Service manpage). Returns an object reference or undef on error, as above.

iterator(\%config)

Instantiate a new template iterator object (default: the Template::Iterator manpage). Returns an object reference or undef on error, as above.

constants(\%config)

Instantiate a new namespace handler for compile time constant folding (default: the Template::Namespace::Constants manpage). Returns an object reference or undef on error, as above.

instdir($dir)

Returns the root directory of the Template Toolkit installation under which optional components are installed. Any relative directory specified as an argument will be appended to the returned directory.

    # e.g. returns '/usr/local/tt2'
    my $ttroot = Template::Config->instdir()
        || die "$Template::Config::ERROR\n";
    # e.g. returns '/usr/local/tt2/templates'
    my $template = Template::Config->instdir('templates')
        || die "$Template::Config::ERROR\n";

Returns undef and sets $Template::Config::ERROR appropriately if the optional components of the Template Toolkit have not been installed.


AUTHOR

Andy Wardley <abw@wardley.org> http://wardley.org/


COPYRIGHT

Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


SEE ALSO

Template

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024