{
    "content": [
        {
            "type": "text",
            "text": "# Template::Manual::Plugins (perldoc)\n\n## NAME\n\nTemplate::Manual::Plugins - Standard plugins\n\n## Sections\n\n- **NAME**\n- **TEMPLATE TOOLKIT PLUGINS** (14 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Template::Manual::Plugins",
        "section": "",
        "mode": "perldoc",
        "summary": "Template::Manual::Plugins - Standard plugins",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "TEMPLATE TOOLKIT PLUGINS",
                "lines": 4,
                "subsections": [
                    {
                        "name": "Assert",
                        "lines": 29
                    },
                    {
                        "name": "Datafile",
                        "lines": 22
                    },
                    {
                        "name": "Date",
                        "lines": 8
                    },
                    {
                        "name": "Directory",
                        "lines": 15
                    },
                    {
                        "name": "Dumper",
                        "lines": 6
                    },
                    {
                        "name": "File",
                        "lines": 8
                    },
                    {
                        "name": "Filter",
                        "lines": 26
                    },
                    {
                        "name": "Format",
                        "lines": 22
                    },
                    {
                        "name": "Iterator",
                        "lines": 13
                    },
                    {
                        "name": "Pod",
                        "lines": 12
                    },
                    {
                        "name": "Scalar",
                        "lines": 16
                    },
                    {
                        "name": "String",
                        "lines": 11
                    },
                    {
                        "name": "Table",
                        "lines": 22
                    },
                    {
                        "name": "Wrap",
                        "lines": 17
                    }
                ]
            }
        ],
        "sections": {
            "NAME": {
                "content": "Template::Manual::Plugins - Standard plugins\n",
                "subsections": []
            },
            "TEMPLATE TOOLKIT PLUGINS": {
                "content": "The following plugin modules are distributed with the Template Toolkit. Some of the plugins\ninterface to external modules (detailed below) which should be downloaded from any CPAN site and\ninstalled before using the plugin.\n",
                "subsections": [
                    {
                        "name": "Assert",
                        "content": "New in 2.20! The Assert plugin adds an \"assert\" virtual method that you can use to catch\nundefined values.\n\nFor example, consider this dotop:\n\n[% user.name %]\n\nIf \"user.name\" is an undefined value then TT will silently ignore the fact and print nothing. If\nyou \"USE\" the \"assert\" plugin then you can add the \"assert\" vmethod between the \"user\" and\n\"name\" elements, like so:\n\n[% user.assert.name %]\n\nNow, if \"user.name\" is an undefined value, an exception will be thrown:\n\nassert error - undefined value for name\n\nCGI\nThe CGI plugin is a wrapper around Lincoln Stein's CGI.pm module. The plugin is distributed with\nthe Template Toolkit (see Template::Plugin::CGI) and the CGI module itself is distributed with\nrecent versions Perl, or is available from CPAN.\n\n[% USE CGI %]\n[% CGI.param('paramname') %]\n[% CGI.startform %]\n[% CGI.popupmenu( Name   => 'color',\nValues => [ 'Green', 'Brown' ] ) %]\n[% CGI.endform %]\n"
                    },
                    {
                        "name": "Datafile",
                        "content": "Provides an interface to data stored in a plain text file in a simple delimited format. The\nfirst line in the file specifies field names which should be delimiter by any non-word character\nsequence. Subsequent lines define data using the same delimiter as in the first line. Blank\nlines and comments (lines starting '#') are ignored. See Template::Plugin::Datafile for further\ndetails.\n\n/tmp/mydata:\n\n# define names for each field\nid : email : name : tel\n# here's the data\nfred : fred@here.com : Fred Smith : 555-1234\nbill : bill@here.com : Bill White : 555-5678\n\nexample:\n\n[% USE userlist = datafile('/tmp/mydata') %]\n\n[% FOREACH user = userlist %]\n[% user.name %] ([% user.id %])\n[% END %]\n"
                    },
                    {
                        "name": "Date",
                        "content": "The Date plugin provides an easy way to generate formatted time and date strings by delegating\nto the POSIX \"strftime()\" routine. See Template::Plugin::Date and POSIX for further details.\n\n[% USE date %]\n[% date.format %]           # current time/date\n\nFile last modified: [% date.format(template.modtime) %]\n"
                    },
                    {
                        "name": "Directory",
                        "content": "The Directory plugin provides a simple interface to a directory and the files within it. See\nTemplate::Plugin::Directory for further details.\n\n[% USE dir = Directory('/tmp') %]\n[% FOREACH file = dir.files %]\n# all the plain files in the directory\n[% END %]\n[% FOREACH file = dir.dirs %]\n# all the sub-directories\n[% END %]\n\nDBI\nThe \"DBI\" plugin is no longer distributed as part of the Template Toolkit (as of version 2.15).\nIt is now available as a separate Template::DBI distribution from CPAN.\n"
                    },
                    {
                        "name": "Dumper",
                        "content": "The Dumper plugin provides an interface to the Data::Dumper module. See Template::Plugin::Dumper\nand Data::Dumper for further details.\n\n[% USE dumper(indent=0, pad=\"<br>\") %]\n[% dumper.dump(myvar, yourvar) %]\n"
                    },
                    {
                        "name": "File",
                        "content": "The File plugin provides a general abstraction for files and can be used to fetch information\nabout specific files within a filesystem. See Template::Plugin::File for further details.\n\n[% USE File('/tmp/foo.html') %]\n[% File.name %]     # foo.html\n[% File.dir %]      # /tmp\n[% File.mtime %]    # modification time\n"
                    },
                    {
                        "name": "Filter",
                        "content": "This module implements a base class plugin which can be subclassed to easily create your own\nmodules that define and install new filters.\n\npackage MyOrg::Template::Plugin::MyFilter;\n\nuse Template::Plugin::Filter;\nuse base qw( Template::Plugin::Filter );\n\nsub filter {\nmy ($self, $text) = @;\n# ...mungify $text...\nreturn $text;\n}\n\nExample of use:\n\n# now load it...\n[% USE MyFilter %]\n\n# ...and use the returned object as a filter\n[% FILTER $MyFilter %]\n...\n[% END %]\n\nSee Template::Plugin::Filter for further details.\n"
                    },
                    {
                        "name": "Format",
                        "content": "The Format plugin provides a simple way to format text according to a \"printf()\"-like format.\nSee Template::Plugin::Format for further details.\n\n[% USE bold = format('<b>%s</b>') %]\n[% bold('Hello') %]\n\nGD\nThe \"GD\" plugins are no longer part of the core Template Toolkit distribution. They are now\navailable from CPAN in a separate Template::GD distribution.\n\nHTML\nThe HTML plugin is very basic, implementing a few useful methods for generating HTML. It is\nlikely to be extended in the future or integrated with a larger project to generate HTML\nelements in a generic way.\n\n[% USE HTML %]\n[% HTML.escape(\"if (a < b && c > d) ...\" %]\n[% HTML.attributes(border => 1, cellpadding => 2) %]\n[% HTML.element(table => { border => 1, cellpadding => 2 }) %]\n\nSee Template::Plugin::HTML for further details.\n"
                    },
                    {
                        "name": "Iterator",
                        "content": "The Iterator plugin provides a way to create a Template::Iterator object to iterate over a data\nset. An iterator is created automatically by the \"FOREACH\" directive and is aliased to the\n\"loop\" variable. This plugin allows an iterator to be explicitly created with a given name, or\nthe default plugin name, \"iterator\". See Template::Plugin::Iterator for further details.\n\n[% USE iterator(list, args) %]\n\n[% FOREACH item = iterator %]\n[% '<ul>' IF iterator.first %]\n<li>[% item %]\n[% '</ul>' IF iterator.last %]\n[% END %]\n"
                    },
                    {
                        "name": "Pod",
                        "content": "This plugin provides an interface to the Pod::POM module which parses POD documents into an\ninternal object model which can then be traversed and presented through the Template Toolkit.\n\n[% USE Pod(podfile) %]\n\n[% FOREACH head1 = Pod.head1;\nFOREACH head2 = head1/head2;\n...\nEND;\nEND\n%]\n"
                    },
                    {
                        "name": "Scalar",
                        "content": "The Template Toolkit calls user-defined subroutines and object methods using Perl's array\ncontext by default.\n\n# TT2 calls object methods in array context by default\n[% object.method %]\n\nThis plugin module provides a way for you to call subroutines and methods in scalar context.\n\n[% USE scalar %]\n\n# force it to use scalar context\n[% object.scalar.method %]\n\n# also works with subroutine references\n[% scalar.mysubref %]\n"
                    },
                    {
                        "name": "String",
                        "content": "The String plugin implements an object-oriented interface for manipulating strings. See\nTemplate::Plugin::String for further details.\n\n[% USE String 'Hello' %]\n[% String.append(' World') %]\n\n[% msg = String.new('Another string') %]\n[% msg.replace('string', 'text') %]\n\nThe string \"[% msg %]\" is [% msg.length %] characters long.\n"
                    },
                    {
                        "name": "Table",
                        "content": "The Table plugin allows you to format a list of data items into a virtual table by specifying a\nfixed number of rows or columns, with an optional overlap. See Template::Plugin::Table for\nfurther details.\n\n[% USE table(list, rows=10, overlap=1) %]\n\n[% FOREACH item = table.col(3) %]\n[% item %]\n[% END %]\n\nURL\nThe URL plugin provides a simple way of constructing URLs from a base part and a variable set of\nparameters. See Template::Plugin::URL for further details.\n\n[% USE mycgi = url('/cgi-bin/bar.pl', debug=1) %]\n\n[% mycgi %]\n# ==> /cgi/bin/bar.pl?debug=1\n\n[% mycgi(mode='submit') %]\n# ==> /cgi/bin/bar.pl?mode=submit&debug=1\n"
                    },
                    {
                        "name": "Wrap",
                        "content": "The Wrap plugin uses the Text::Wrap module to provide simple paragraph formatting. See\nTemplate::Plugin::Wrap and Text::Wrap for further details.\n\n[% USE wrap %]\n[% wrap(mytext, 40, '* ', '  ') %]  # use wrap sub\n[% mytext FILTER wrap(40) -%]       # or wrap FILTER\n\nThe \"Text::Wrap\" module is available from CPAN:\n\nhttp://www.cpan.org/modules/by-module/Text/\n\nXML\nThe \"XML::DOM\", \"XML::RSS\", \"XML::Simple\" and \"XML::XPath\" plugins are no longer distributed\nwith the Template Toolkit as of version 2.15\n\nThey are now available in a separate Template::XML distribution.\n"
                    }
                ]
            }
        }
    }
}