{
    "mode": "perldoc",
    "parameter": "Template::Plugins",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Template%3A%3APlugins/json",
    "generated": "2026-07-05T13:44:56Z",
    "synopsis": "use Template::Plugins;\n$pluginprovider = Template::Plugins->new(\\%options);\n($plugin, $error) = $pluginprovider->fetch($name, @args);",
    "sections": {
        "NAME": {
            "content": "Template::Plugins - Plugin provider module\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Template::Plugins;\n\n$pluginprovider = Template::Plugins->new(\\%options);\n\n($plugin, $error) = $pluginprovider->fetch($name, @args);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The \"Template::Plugins\" module defines a provider class which can be used to load and\ninstantiate Template Toolkit plugin modules.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "new(\\%params)\nConstructor method which instantiates and returns a reference to a \"Template::Plugins\" object. A\nreference to a hash array of configuration items may be passed as a parameter. These are\ndescribed below.\n\nNote that the Template front-end module creates a \"Template::Plugins\" provider, passing all\nconfiguration items. Thus, the examples shown below in the form:\n\n$plugprov = Template::Plugins->new({\nPLUGINBASE => 'MyTemplate::Plugin',\nLOADPERL   => 1,\n...\n});\n\ncan also be used via the Template module as:\n\n$ttengine = Template->new({\nPLUGINBASE => 'MyTemplate::Plugin',\nLOADPERL   => 1,\n...\n});\n\nas well as the more explicit form of:\n\n$plugprov = Template::Plugins->new({\nPLUGINBASE => 'MyTemplate::Plugin',\nLOADPERL   => 1,\n...\n});\n\n$ttengine = Template->new({\nLOADPLUGINS => [ $plugprov ],\n});\n\nfetch($name, @args)\nCalled to request that a plugin of a given name be provided. The relevant module is first loaded\n(if necessary) and the load() class method called to return the factory class name (usually the\nsame package name) or a factory object (a prototype). The new() method is then called as a class\nor object method against the factory, passing all remaining parameters.\n\nReturns a reference to a new plugin object or \"($error, STATUSERROR)\" on error. May also return\n\"(undef, STATUSDECLINED)\" to decline to serve the request. If \"TOLERANT\" is set then all errors\nwill be returned as declines.\n",
            "subsections": []
        },
        "CONFIGURATION OPTIONS": {
            "content": "The following list summarises the configuration options that can be provided to the\n\"Template::Plugins\" new() constructor. Please consult Template::Manual::Config for further\ndetails and examples of each configuration option in use.\n\nPLUGINS\nThe PLUGINS option can be used to provide a reference to a hash array that maps plugin names to\nPerl module names.\n\nmy $plugins = Template::Plugins->new({\nPLUGINS => {\ncgi => 'MyOrg::Template::Plugin::CGI',\nfoo => 'MyOrg::Template::Plugin::Foo',\nbar => 'MyOrg::Template::Plugin::Bar',\n},\n});\n\nPLUGINBASE\nIf a plugin is not defined in the PLUGINS hash then the PLUGINBASE is used to attempt to\nconstruct a correct Perl module name which can be successfully loaded.\n\n# single value PLUGINBASE\nmy $plugins = Template::Plugins->new({\nPLUGINBASE => 'MyOrg::Template::Plugin',\n});\n\n# multiple value PLUGINBASE\nmy $plugins = Template::Plugins->new({\nPLUGINBASE => [   'MyOrg::Template::Plugin',\n'YourOrg::Template::Plugin'  ],\n});\n\nLOADPERL\nThe LOADPERL option can be set to allow you to load regular Perl modules (i.e. those that don't\nreside in the \"Template::Plugin\" or another user-defined namespace) as plugins.\n\nIf a plugin cannot be loaded using the PLUGINS or PLUGINBASE approaches then, if the LOADPERL\nis set, the provider will make a final attempt to load the module without prepending any prefix\nto the module path.\n\nUnlike regular plugins, modules loaded using LOADPERL do not receive a Template::Context\nreference as the first argument to the \"new()\" constructor method.\n\nTOLERANT\nThe TOLERANT flag can be set to indicate that the \"Template::Plugins\" module should ignore any\nerrors encountered while loading a plugin and instead return \"STATUSDECLINED\".\n\nDEBUG\nThe DEBUG option can be used to enable debugging messages for the \"Template::Plugins\" module by\nsetting it to include the \"DEBUGPLUGINS\" value.\n\nuse Template::Constants qw( :debug );\n\nmy $template = Template->new({\nDEBUG => DEBUGFILTERS | DEBUGPLUGINS,\n});\n",
            "subsections": []
        },
        "TEMPLATE TOOLKIT PLUGINS": {
            "content": "Please see Template::Manual::Plugins For a complete list of all the plugin modules distributed\nwith the Template Toolkit.\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::Manual::Plugins, Template::Plugin, Template::Context, Template.\n",
            "subsections": []
        }
    },
    "summary": "Template::Plugins - Plugin provider module",
    "flags": [],
    "examples": [],
    "see_also": []
}