# man > Template::Config(3pm)

---
type: CommandReference
command: Template::Config
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference

- `Template::Config->load($module)` — Load a Perl module via `require()`
- `Template::Config->preload()` — Preload all common `Template::*` modules (used under mod_perl)
- `Template::Config->parser(\%config)` — Instantiate a new parser object (default `Template::Parser`)
- `Template::Config->provider(\%config)` — Instantiate a new template provider (default `Template::Provider`)
- `Template::Config->stash(\%vars)` — Instantiate a new stash object (default `Template::Stash` or `Template::Stash::XS`)
- `Template::Config->context(\%config)` — Instantiate a new context object (default `Template::Context`)
- `Template::Config->service(\%config)` — Instantiate a new service object (default `Template::Service`)
- `Template::Config->instdir($dir)` — Return the root installation directory of the Template Toolkit

## Name

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

## Synopsis

perl
use Template::Config;
## Options

- `load($module)` — Load a module using Perl's `require()`. Converts `::` to `/` and appends `.pm`. Returns 1 on success, undef on error. Use `$class->error()` to examine the error string.
- `preload()` — Preloads all other `Template::*` modules likely to be used. Called automatically by the Template module under mod_perl.
- `parser(\%config)` — Instantiate a new parser object of the class named by `$PARSER` (default `Template::Parser`). Returns object reference or undef on error.
- `provider(\%config)` — Instantiate a new template provider object (default `Template::Provider`). Returns object reference or undef on error.
- `plugins(\%config)` — Instantiate a new plugins provider object (default `Template::Plugins`). Returns object reference or undef on error.
- `filters(\%config)` — Instantiate a new filter provider object (default `Template::Filters`). Returns object reference or undef on error.
- `stash(\%vars)` — Instantiate a new stash object (`Template::Stash` or `Template::Stash::XS` depending on installation default) using the optional hash as initial variable definitions. Returns object reference or undef on error.
- `context(\%config)` — Instantiate a new template context object (default `Template::Context`). Returns object reference or undef on error.
- `service(\%config)` — Instantiate a new template service object (default `Template::Service`). Returns object reference or undef on error.
- `iterator(\%config)` — Instantiate a new template iterator object (default `Template::Iterator`). Returns object reference or undef on error.
- `constants(\%config)` — Instantiate a new namespace handler for compile-time constant folding (default `Template::Namespace::Constants`). Returns object reference or undef on error.
- `instdir($dir)` — Returns the root directory of the Template Toolkit installation. Any relative directory passed as argument is appended. Returns undef and sets `$Template::Config::ERROR` if optional components are not installed.

## See Also

- [Template](http://localhost/phpMan.php/perldoc/Template/markdown)