{
    "content": [
        {
            "type": "text",
            "text": "# Template::Config (perldoc)\n\n## NAME\n\nTemplate::Config - Factory module for instantiating other TT2 modules\n\n## SYNOPSIS\n\nuse Template::Config;\n\n## DESCRIPTION\n\nThis module implements various methods for loading and instantiating other modules that comprise\nthe Template Toolkit. It provides a consistent way to create toolkit components and allows\ncustom modules to be used in place of the regular ones.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PUBLIC METHODS**\n- **AUTHOR**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Template::Config",
        "section": "",
        "mode": "perldoc",
        "summary": "Template::Config - Factory module for instantiating other TT2 modules",
        "synopsis": "use Template::Config;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "PUBLIC METHODS",
                "lines": 63,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Template::Config - Factory module for instantiating other TT2 modules\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Template::Config;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This module implements various methods for loading and instantiating other modules that comprise\nthe Template Toolkit. It provides a consistent way to create toolkit components and allows\ncustom modules to be used in place of the regular ones.\n\nPackage variables such as $STASH, $SERVICE, $CONTEXT, etc., contain the default module/package\nname for each component (Template::Stash, Template::Service and Template::Context, respectively)\nand are used by the various factory methods (stash(), service() and context()) to load the\nappropriate module. Changing these package variables will cause subsequent calls to the relevant\nfactory method to load and instantiate an object from the new class.\n",
                "subsections": []
            },
            "PUBLIC METHODS": {
                "content": "load($module)\nLoad a module using Perl's require(). Any occurrences of '\"::\"' in the module name are be\nconverted to '\"/\"', and '\".pm\"' is appended. Returns 1 on success or undef on error. Use\n\"$class->error()\" to examine the error string.\n\npreload()\nThis method preloads all the other \"Template::*\" modules that are likely to be used. It is\ncalled automatically by the Template module when running under modperl ($ENV{MODPERL} is set).\n\nparser(\\%config)\nInstantiate a new parser object of the class whose name is denoted by the package variable\n$PARSER (default: Template::Parser). Returns a reference to a newly instantiated parser object\nor undef on error.\n\nprovider(\\%config)\nInstantiate a new template provider object (default: Template::Provider). Returns an object\nreference or undef on error, as above.\n\nplugins(\\%config)\nInstantiate a new plugins provider object (default: Template::Plugins). Returns an object\nreference or undef on error, as above.\n\nfilters(\\%config)\nInstantiate a new filter provider object (default: Template::Filters). Returns an object\nreference or undef on error, as above.\n\nstash(\\%vars)\nInstantiate a new stash object (Template::Stash or Template::Stash::XS depending on the default\nset at installation time) using the contents of the optional hash array passed by parameter as\ninitial variable definitions. Returns an object reference or undef on error, as above.\n\ncontext(\\%config)\nInstantiate a new template context object (default: Template::Context). Returns an object\nreference or undef on error, as above.\n\nservice(\\%config)\nInstantiate a new template service object (default: Template::Service). Returns an object\nreference or undef on error, as above.\n\niterator(\\%config)\nInstantiate a new template iterator object (default: Template::Iterator). Returns an object\nreference or undef on error, as above.\n\nconstants(\\%config)\nInstantiate a new namespace handler for compile time constant folding (default:\nTemplate::Namespace::Constants). Returns an object reference or undef on error, as above.\n\ninstdir($dir)\nReturns the root directory of the Template Toolkit installation under which optional components\nare installed. Any relative directory specified as an argument will be appended to the returned\ndirectory.\n\n# e.g. returns '/usr/local/tt2'\nmy $ttroot = Template::Config->instdir()\n|| die \"$Template::Config::ERROR\\n\";\n\n# e.g. returns '/usr/local/tt2/templates'\nmy $template = Template::Config->instdir('templates')\n|| die \"$Template::Config::ERROR\\n\";\n\nReturns \"undef\" and sets $Template::Config::ERROR appropriately if the optional components of\nthe Template Toolkit have not been installed.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Andy Wardley <abw@wardley.org> <http://wardley.org/>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.\n\nThis module is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Template\n",
                "subsections": []
            }
        }
    }
}