{
    "mode": "perldoc",
    "parameter": "Text::Template",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Text%3A%3ATemplate/json",
    "generated": "2026-06-12T04:36:26Z",
    "synopsis": "use Text::Template;\n$template = Text::Template->new(TYPE => 'FILE',  SOURCE => 'filename.tmpl');\n$template = Text::Template->new(TYPE => 'ARRAY', SOURCE => [ ... ] );\n$template = Text::Template->new(TYPE => 'FILEHANDLE', SOURCE => $fh );\n$template = Text::Template->new(TYPE => 'STRING', SOURCE => '...' );\n$template = Text::Template->new(PREPEND => q{use strict;}, ...);\n# Use a different template file syntax:\n$template = Text::Template->new(DELIMITERS => [$open, $close], ...);\n$recipient = 'King';\n$text = $template->fillin();  # Replaces `{$recipient}' with `King'\nprint $text;\n$T::recipient = 'Josh';\n$text = $template->fillin(PACKAGE => T);\n# Pass many variables explicitly\n$hash = { recipient => 'Abed-Nego',\nfriends => [ 'me', 'you' ],\nenemies => { loathsome => 'Saruman',\nfearsome => 'Sauron' },\n};\n$text = $template->fillin(HASH => $hash, ...);\n# $recipient is Abed-Nego,\n# @friends is ( 'me', 'you' ),\n# %enemies is ( loathsome => ..., fearsome => ... )\n# Call &callback in case of programming errors in template\n$text = $template->fillin(BROKEN => \\&callback, BROKENARG => $ref, ...);\n# Evaluate program fragments in Safe compartment with restricted permissions\n$text = $template->fillin(SAFE => $compartment, ...);\n# Print result text instead of returning it\n$success = $template->fillin(OUTPUT => \\*FILEHANDLE, ...);\n# Parse template with different template file syntax:\n$text = $template->fillin(DELIMITERS => [$open, $close], ...);\n# Note that this is *faster* than using the default delimiters\n# Prepend specified perl code to each fragment before evaluating:\n$text = $template->fillin(PREPEND => q{use strict 'vars';}, ...);\nuse Text::Template 'fillinstring';\n$text = fillinstring( <<'EOM', PACKAGE => 'T', ...);\nDear {$recipient},\nPay me at once.\nLove,\nG.V.\nEOM\nuse Text::Template 'fillinfile';\n$text = fillinfile($filename, ...);\n# All templates will always have `use strict vars' attached to all fragments\nText::Template->alwaysprepend(q{use strict 'vars';});",
    "sections": {
        "NAME": {
            "content": "Text::Template - Expand template text with embedded Perl\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 1.60\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Text::Template;\n\n\n$template = Text::Template->new(TYPE => 'FILE',  SOURCE => 'filename.tmpl');\n$template = Text::Template->new(TYPE => 'ARRAY', SOURCE => [ ... ] );\n$template = Text::Template->new(TYPE => 'FILEHANDLE', SOURCE => $fh );\n$template = Text::Template->new(TYPE => 'STRING', SOURCE => '...' );\n$template = Text::Template->new(PREPEND => q{use strict;}, ...);\n\n# Use a different template file syntax:\n$template = Text::Template->new(DELIMITERS => [$open, $close], ...);\n\n$recipient = 'King';\n$text = $template->fillin();  # Replaces `{$recipient}' with `King'\nprint $text;\n\n$T::recipient = 'Josh';\n$text = $template->fillin(PACKAGE => T);\n\n# Pass many variables explicitly\n$hash = { recipient => 'Abed-Nego',\nfriends => [ 'me', 'you' ],\nenemies => { loathsome => 'Saruman',\nfearsome => 'Sauron' },\n};\n$text = $template->fillin(HASH => $hash, ...);\n# $recipient is Abed-Nego,\n# @friends is ( 'me', 'you' ),\n# %enemies is ( loathsome => ..., fearsome => ... )\n\n\n# Call &callback in case of programming errors in template\n$text = $template->fillin(BROKEN => \\&callback, BROKENARG => $ref, ...);\n\n# Evaluate program fragments in Safe compartment with restricted permissions\n$text = $template->fillin(SAFE => $compartment, ...);\n\n# Print result text instead of returning it\n$success = $template->fillin(OUTPUT => \\*FILEHANDLE, ...);\n\n# Parse template with different template file syntax:\n$text = $template->fillin(DELIMITERS => [$open, $close], ...);\n# Note that this is *faster* than using the default delimiters\n\n# Prepend specified perl code to each fragment before evaluating:\n$text = $template->fillin(PREPEND => q{use strict 'vars';}, ...);\n\nuse Text::Template 'fillinstring';\n$text = fillinstring( <<'EOM', PACKAGE => 'T', ...);\nDear {$recipient},\nPay me at once.\nLove,\nG.V.\nEOM\n\nuse Text::Template 'fillinfile';\n$text = fillinfile($filename, ...);\n\n# All templates will always have `use strict vars' attached to all fragments\nText::Template->alwaysprepend(q{use strict 'vars';});\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This is a library for generating form letters, building HTML pages, or filling in templates\ngenerally. A `template' is a piece of text that has little Perl programs embedded in it here and\nthere. When you `fill in' a template, you evaluate the little programs and replace them with\ntheir values.\n\nYou can store a template in a file outside your program. People can modify the template without\nmodifying the program. You can separate the formatting details from the main code, and put the\nformatting parts of the program into the template. That prevents code bloat and encourages\nfunctional separation.\n",
            "subsections": [
                {
                    "name": "Example",
                    "content": "Here's an example of a template, which we'll suppose is stored in the file \"formletter.tmpl\":\n\nDear {$title} {$lastname},\n\nIt has come to our attention that you are delinquent in your\n{$monthname[$lastpaidmonth]} payment.  Please remit\n${sprintf(\"%.2f\", $amount)} immediately, or your patellae may\nbe needlessly endangered.\n\nLove,\n\nMark \"Vizopteryx\" Dominus\n\nThe result of filling in this template is a string, which might look something like this:\n\nDear Mr. Smith,\n\nIt has come to our attention that you are delinquent in your\nFebruary payment.  Please remit\n$392.12 immediately, or your patellae may\nbe needlessly endangered.\n\n\nLove,\n\nMark \"Vizopteryx\" Dominus\n\nHere is a complete program that transforms the example template into the example result, and\nprints it out:\n\nuse Text::Template;\n\nmy $template = Text::Template->new(SOURCE => 'formletter.tmpl')\nor die \"Couldn't construct template: $Text::Template::ERROR\";\n\nmy @monthname = qw(January February March April May June\nJuly August September October November December);\nmy %vars = (title           => 'Mr.',\nfirstname       => 'John',\nlastname        => 'Smith',\nlastpaidmonth => 1,   # February\namount          => 392.12,\nmonthname       => \\@monthname);\n\nmy $result = $template->fillin(HASH => \\%vars);\n\nif (defined $result) { print $result }\nelse { die \"Couldn't fill in template: $Text::Template::ERROR\" }\n"
                },
                {
                    "name": "Philosophy",
                    "content": "When people make a template module like this one, they almost always start by inventing a\nspecial syntax for substitutions. For example, they build it so that a string like \"%%VAR%%\" is\nreplaced with the value of $VAR. Then they realize the need extra formatting, so they put in\nsome special syntax for formatting. Then they need a loop, so they invent a loop syntax. Pretty\nsoon they have a new little template language.\n\nThis approach has two problems: First, their little language is crippled. If you need to do\nsomething the author hasn't thought of, you lose. Second: Who wants to learn another language?\nYou already know Perl, so why not use it?\n\n\"Text::Template\" templates are programmed in *Perl*. You embed Perl code in your template, with\n\"{\" at the beginning and \"}\" at the end. If you want a variable interpolated, you write it the\nway you would in Perl. If you need to make a loop, you can use any of the Perl loop\nconstructions. All the Perl built-in functions are available.\n"
                }
            ]
        },
        "Details": {
            "content": "",
            "subsections": [
                {
                    "name": "Template Parsing",
                    "content": "The \"Text::Template\" module scans the template source. An open brace \"{\" begins a program\nfragment, which continues until the matching close brace \"}\". When the template is filled in,\nthe program fragments are evaluated, and each one is replaced with the resulting value to yield\nthe text that is returned.\n\nA backslash \"\\\" in front of a brace (or another backslash that is in front of a brace) escapes\nits special meaning. The result of filling out this template:\n\n\\{ The sum of 1 and 2 is {1+2}  \\}\n\nis\n\n{ The sum of 1 and 2 is 3  }\n\nIf you have an unmatched brace, \"Text::Template\" will return a failure code and a warning about\nwhere the problem is. Backslashes that do not precede a brace are passed through unchanged. If\nyou have a template like this:\n\n{ \"String that ends in a newline.\\n\" }\n\nThe backslash inside the string is passed through to Perl unchanged, so the \"\\n\" really does\nturn into a newline. See the note at the end for details about the way backslashes work.\nBackslash processing is *not* done when you specify alternative delimiters with the \"DELIMITERS\"\noption. (See \"Alternative Delimiters\", below.)\n\nEach program fragment should be a sequence of Perl statements, which are evaluated the usual\nway. The result of the last statement executed will be evaluated in scalar context; the result\nof this statement is a string, which is interpolated into the template in place of the program\nfragment itself.\n\nThe fragments are evaluated in order, and side effects from earlier fragments will persist into\nlater fragments:\n\n{$x = @things; ''}The Lord High Chamberlain has gotten {$x}\nthings for me this year.\n{ $diff = $x - 17;\n$more = 'more'\nif ($diff == 0) {\n$diff = 'no';\n} elsif ($diff < 0) {\n$more = 'fewer';\n}\n'';\n}\nThat is {$diff} {$more} than he gave me last year.\n\nThe value of $x set in the first line will persist into the next fragment that begins on the\nthird line, and the values of $diff and $more set in the second fragment will persist and be\ninterpolated into the last line. The output will look something like this:\n\nThe Lord High Chamberlain has gotten 42\nthings for me this year.\n\nThat is 25 more than he gave me last year.\n\nThat is all the syntax there is.\n\nThe $OUT variable\nThere is one special trick you can play in a template. Here is the motivation for it: Suppose\nyou are going to pass an array, @items, into the template, and you want the template to generate\na bulleted list with a header, like this:\n\nHere is a list of the things I have got for you since 1907:\n* Ivory\n* Apes\n* Peacocks\n* ...\n\nOne way to do it is with a template like this:\n\nHere is a list of the things I have got for you since 1907:\n{ my $blist = '';\nforeach $i (@items) {\n$blist .= qq{  * $i\\n};\n}\n$blist;\n}\n\nHere we construct the list in a variable called $blist, which we return at the end. This is a\nlittle cumbersome. There is a shortcut.\n\nInside of templates, there is a special variable called $OUT. Anything you append to this\nvariable will appear in the output of the template. Also, if you use $OUT in a program fragment,\nthe normal behavior, of replacing the fragment with its return value, is disabled; instead the\nfragment is replaced with the value of $OUT. This means that you can write the template above\nlike this:\n\nHere is a list of the things I have got for you since 1907:\n{ foreach $i (@items) {\n$OUT .= \"  * $i\\n\";\n}\n}\n\n$OUT is reinitialized to the empty string at the start of each program fragment. It is private\nto \"Text::Template\", so you can't use a variable named $OUT in your template without invoking\nthe special behavior.\n"
                },
                {
                    "name": "General Remarks",
                    "content": "All \"Text::Template\" functions return \"undef\" on failure, and set the variable\n$Text::Template::ERROR to contain an explanation of what went wrong. For example, if you try to\ncreate a template from a file that does not exist, $Text::Template::ERROR will contain something\nlike:\n\nCouldn't open file xyz.tmpl: No such file or directory\n\n\"new\"\n$template = Text::Template->new( TYPE => ..., SOURCE => ... );\n\nThis creates and returns a new template object. \"new\" returns \"undef\" and sets\n$Text::Template::ERROR if it can't create the template object. \"SOURCE\" says where the template\nsource code will come from. \"TYPE\" says what kind of object the source is.\n\nThe most common type of source is a file:\n\nText::Template->new( TYPE => 'FILE', SOURCE => $filename );\n\nThis reads the template from the specified file. The filename is opened with the Perl \"open\"\ncommand, so it can be a pipe or anything else that makes sense with \"open\".\n\nThe \"TYPE\" can also be \"STRING\", in which case the \"SOURCE\" should be a string:\n\nText::Template->new( TYPE => 'STRING',\nSOURCE => \"This is the actual template!\" );\n\nThe \"TYPE\" can be \"ARRAY\", in which case the source should be a reference to an array of\nstrings. The concatenation of these strings is the template:\n\nText::Template->new( TYPE => 'ARRAY',\nSOURCE => [ \"This is \", \"the actual\",\n\" template!\",\n]\n);\n\nThe \"TYPE\" can be FILEHANDLE, in which case the source should be an open filehandle (such as you\ngot from the \"FileHandle\" or \"IO::*\" packages, or a glob, or a reference to a glob). In this\ncase \"Text::Template\" will read the text from the filehandle up to end-of-file, and that text is\nthe template:\n\n# Read template source code from STDIN:\nText::Template->new ( TYPE => 'FILEHANDLE',\nSOURCE => \\*STDIN  );\n\nIf you omit the \"TYPE\" attribute, it's taken to be \"FILE\". \"SOURCE\" is required. If you omit it,\nthe program will abort.\n\nThe words \"TYPE\" and \"SOURCE\" can be spelled any of the following ways:\n\nTYPE     SOURCE\nType     Source\ntype     source\n-TYPE    -SOURCE\n-Type    -Source\n-type    -source\n\nPick a style you like and stick with it.\n\n\"DELIMITERS\"\nYou may also add a \"DELIMITERS\" option. If this option is present, its value should be a\nreference to an array of two strings. The first string is the string that signals the\nbeginning of each program fragment, and the second string is the string that signals the end\nof each program fragment. See \"Alternative Delimiters\", below.\n\n\"ENCODING\"\nYou may also add a \"ENCODING\" option. If this option is present, and the \"SOURCE\" is a\n\"FILE\", then the data will be decoded from the given encoding using the Encode module. You\ncan use any encoding that Encode recognizes. E.g.:\n\nText::Template->new(\nTYPE     => 'FILE',\nENCODING => 'UTF-8',\nSOURCE   => 'xyz.tmpl');\n\n\"UNTAINT\"\nIf your program is running in taint mode, you may have problems if your templates are stored\nin files. Data read from files is considered 'untrustworthy', and taint mode will not allow\nyou to evaluate the Perl code in the file. (It is afraid that a malicious person might have\ntampered with the file.)\n\nIn some environments, however, local files are trustworthy. You can tell \"Text::Template\"\nthat a certain file is trustworthy by supplying \"UNTAINT => 1\" in the call to \"new\". This\nwill tell \"Text::Template\" to disable taint checks on template code that has come from a\nfile, as long as the filename itself is considered trustworthy. It will also disable taint\nchecks on template code that comes from a filehandle. When used with \"TYPE => 'string'\" or\n\"TYPE => 'array'\", it has no effect.\n\nSee perlsec for more complete information about tainting.\n\nThanks to Steve Palincsar, Gerard Vreeswijk, and Dr. Christoph Baehr for help with this\nfeature.\n\n\"PREPEND\"\nThis option is passed along to the \"fillin\" call unless it is overridden in the arguments\nto \"fillin\". See \"PREPEND\" feature and using \"strict\" in templates> below.\n\n\"BROKEN\"\nThis option is passed along to the \"fillin\" call unless it is overridden in the arguments\nto \"fillin\". See \"BROKEN\" below.\n\n\"compile\"\n$template->compile()\n\nLoads all the template text from the template's source, parses and compiles it. If successful,\nreturns true; otherwise returns false and sets $Text::Template::ERROR. If the template is\nalready compiled, it returns true and does nothing.\n\nYou don't usually need to invoke this function, because \"fillin\" (see below) compiles the\ntemplate if it isn't compiled already.\n\nIf there is an argument to this function, it must be a reference to an array containing\nalternative delimiter strings. See \"\"Alternative Delimiters\"\", below.\n\n\"fillin\"\n$template->fillin(OPTIONS);\n\nFills in a template. Returns the resulting text if successful. Otherwise, returns \"undef\" and\nsets $Text::Template::ERROR.\n\nThe *OPTIONS* are a hash, or a list of key-value pairs. You can write the key names in any of\nthe six usual styles as above; this means that where this manual says \"PACKAGE\" (for example)\nyou can actually use any of\n\nPACKAGE Package package -PACKAGE -Package -package\n\nPick a style you like and stick with it. The all-lowercase versions may yield spurious warnings\nabout\n\nAmbiguous use of package => resolved to \"package\"\n\nso you might like to avoid them and use the capitalized versions.\n\nAt present, there are eight legal options: \"PACKAGE\", \"BROKEN\", \"BROKENARG\", \"FILENAME\",\n\"SAFE\", \"HASH\", \"OUTPUT\", and \"DELIMITERS\".\n\n\"PACKAGE\"\n\"PACKAGE\" specifies the name of a package in which the program fragments should be\nevaluated. The default is to use the package from which \"fillin\" was called. For example,\nconsider this template:\n\nThe value of the variable x is {$x}.\n\nIf you use \"$template->fillin(PACKAGE => 'R')\" , then the $x in the template is actually\nreplaced with the value of $R::x. If you omit the \"PACKAGE\" option, $x will be replaced with\nthe value of the $x variable in the package that actually called \"fillin\".\n\nYou should almost always use \"PACKAGE\". If you don't, and your template makes changes to\nvariables, those changes will be propagated back into the main program. Evaluating the\ntemplate in a private package helps prevent this. The template can still modify variables in\nyour program if it wants to, but it will have to do so explicitly. See the section at the\nend on `Security'.\n\nHere's an example of using \"PACKAGE\":\n\nYour Royal Highness,\n\nEnclosed please find a list of things I have gotten\nfor you since 1907:\n\n{ foreach $item (@items) {\n$itemno++;\n$OUT .= \" $itemno. \\u$item\\n\";\n}\n}\n\nSigned,\nLord High Chamberlain\n\nWe want to pass in an array which will be assigned to the array @items. Here's how to do\nthat:\n\n@items = ('ivory', 'apes', 'peacocks', );\n$template->fillin();\n\nThis is not very safe. The reason this isn't as safe is that if you had a variable named\n$itemno in scope in your program at the point you called \"fillin\", its value would be\nclobbered by the act of filling out the template. The problem is the same as if you had\nwritten a subroutine that used those variables in the same way that the template does. ($OUT\nis special in templates and is always safe.)\n\nOne solution to this is to make the $itemno variable private to the template by declaring\nit with \"my\". If the template does this, you are safe.\n\nBut if you use the \"PACKAGE\" option, you will probably be safe even if the template does\n*not* declare its variables with \"my\":\n\n@Q::items = ('ivory', 'apes', 'peacocks', );\n$template->fillin(PACKAGE => 'Q');\n\nIn this case the template will clobber the variable $Q::itemno, which is not related to the\none your program was using.\n\nTemplates cannot affect variables in the main program that are declared with \"my\", unless\nyou give the template references to those variables.\n\n\"HASH\"\nYou may not want to put the template variables into a package. Packages can be hard to\nmanage: You can't copy them, for example. \"HASH\" provides an alternative.\n\nThe value for \"HASH\" should be a reference to a hash that maps variable names to values. For\nexample,\n\n$template->fillin(\nHASH => {\nrecipient => \"The King\",\nitems     => ['gold', 'frankincense', 'myrrh'],\nobject    => \\$self,\n}\n);\n\nwill fill out the template and use \"The King\" as the value of $recipient and the list of\nitems as the value of @items. Note that we pass an array reference, but inside the template\nit appears as an array. In general, anything other than a simple string or number should be\npassed by reference.\n\nWe also want to pass an object, which is in $self; note that we pass a reference to the\nobject, \"\\$self\" instead. Since we've passed a reference to a scalar, inside the template\nthe object appears as $object.\n\nThe full details of how it works are a little involved, so you might want to skip to the\nnext section.\n\nSuppose the key in the hash is *key* and the value is *value*.\n\n*   If the *value* is \"undef\", then any variables named $key, @key, %key, etc., are\nundefined.\n\n*   If the *value* is a string or a number, then $key is set to that value in the template.\n\n*   For anything else, you must pass a reference.\n\nIf the *value* is a reference to an array, then @key is set to that array. If the\n*value* is a reference to a hash, then %key is set to that hash. Similarly if *value* is\nany other kind of reference. This means that\n\nvar => \"foo\"\n\nand\n\nvar => \\\"foo\"\n\nhave almost exactly the same effect. (The difference is that in the former case, the\nvalue is copied, and in the latter case it is aliased.)\n\n*   In particular, if you want the template to get an object or any kind, you must pass a\nreference to it:\n\n$template->fillin(HASH => { databasehandle => \\$dbh, ... });\n\nIf you do this, the template will have a variable $databasehandle which is the database\nhandle object. If you leave out the \"\\\", the template will have a hash %databasehandle,\nwhich exposes the internal structure of the database handle object; you don't want that.\n\nNormally, the way this works is by allocating a private package, loading all the variables\ninto the package, and then filling out the template as if you had specified that package. A\nnew package is allocated each time. However, if you *also* use the \"PACKAGE\" option,\n\"Text::Template\" loads the variables into the package you specified, and they stay there\nafter the call returns. Subsequent calls to \"fillin\" that use the same package will pick up\nthe values you loaded in.\n\nIf the argument of \"HASH\" is a reference to an array instead of a reference to a hash, then\nthe array should contain a list of hashes whose contents are loaded into the template\npackage one after the other. You can use this feature if you want to combine several sets of\nvariables. For example, one set of variables might be the defaults for a fill-in form, and\nthe second set might be the user inputs, which override the defaults when they are present:\n\n$template->fillin(HASH => [\\%defaults, \\%userinput]);\n\nYou can also use this to set two variables with the same name:\n\n$template->fillin(\nHASH => [\n{ v => \"The King\" },\n{ v => [1,2,3] }\n]\n);\n\nThis sets $v to \"The King\" and @v to \"(1,2,3)\".\n\n\"BROKEN\"\nIf any of the program fragments fails to compile or aborts for any reason, and you have set\nthe \"BROKEN\" option to a function reference, \"Text::Template\" will invoke the function. This\nfunction is called the *\"BROKEN\" function*. The \"BROKEN\" function will tell \"Text::Template\"\nwhat to do next.\n\nIf the \"BROKEN\" function returns \"undef\", \"Text::Template\" will immediately abort processing\nthe template and return the text that it has accumulated so far. If your function does this,\nit should set a flag that you can examine after \"fillin\" returns so that you can tell\nwhether there was a premature return or not.\n\nIf the \"BROKEN\" function returns any other value, that value will be interpolated into the\ntemplate as if that value had been the return value of the program fragment to begin with.\nFor example, if the \"BROKEN\" function returns an error string, the error string will be\ninterpolated into the output of the template in place of the program fragment that cased the\nerror.\n\nIf you don't specify a \"BROKEN\" function, \"Text::Template\" supplies a default one that\nreturns something like\n\nProgram fragment delivered error ``Illegal division by 0 at\ntemplate line 37''\n\n(Note that the format of this message has changed slightly since version 1.31.) The return\nvalue of the \"BROKEN\" function is interpolated into the template at the place the error\noccurred, so that this template:\n\n(3+4)*5 = { 3+4)*5 }\n\nyields this result:\n\n(3+4)*5 = Program fragment delivered error ``syntax error at template line 1''\n\nIf you specify a value for the \"BROKEN\" attribute, it should be a reference to a function\nthat \"fillin\" can call instead of the default function.\n\n\"fillin\" will pass a hash to the \"broken\" function. The hash will have at least these three\nmembers:\n\n\"text\"\nThe source code of the program fragment that failed\n\n\"error\"\nThe text of the error message ($@) generated by eval.\n\nThe text has been modified to omit the trailing newline and to include the name of the\ntemplate file (if there was one). The line number counts from the beginning of the\ntemplate, not from the beginning of the failed program fragment.\n\n\"lineno\"\nThe line number of the template at which the program fragment began.\n\nThere may also be an \"arg\" member. See \"BROKENARG\", below\n\n\"BROKENARG\"\nIf you supply the \"BROKENARG\" option to \"fillin\", the value of the option is passed to the\n\"BROKEN\" function whenever it is called. The default \"BROKEN\" function ignores the\n\"BROKENARG\", but you can write a custom \"BROKEN\" function that uses the \"BROKENARG\" to get\nmore information about what went wrong.\n\nThe \"BROKEN\" function could also use the \"BROKENARG\" as a reference to store an error\nmessage or some other information that it wants to communicate back to the caller. For\nexample:\n\n$error = '';\n\nsub mybroken {\nmy %args = @;\nmy $errref = $args{arg};\n...\n$$errref = \"Some error message\";\nreturn undef;\n}\n\n$template->fillin(\nBROKEN     => \\&mybroken,\nBROKENARG => \\$error\n);\n\nif ($error) {\ndie \"It didn't work: $error\";\n}\n\nIf one of the program fragments in the template fails, it will call the \"BROKEN\" function,\n\"mybroken\", and pass it the \"BROKENARG\", which is a reference to $error. \"mybroken\" can\nstore an error message into $error this way. Then the function that called \"fillin\" can see\nif \"mybroken\" has left an error message for it to find, and proceed accordingly.\n\n\"FILENAME\"\nIf you give \"fillin\" a \"FILENAME\" option, then this is the file name that you loaded the\ntemplate source from. This only affects the error message that is given for template errors.\nIf you loaded the template from \"foo.txt\" for example, and pass \"foo.txt\" as the \"FILENAME\"\nparameter, errors will look like \"... at foo.txt line N\" rather than \"... at template line\nN\".\n\nNote that this does NOT have anything to do with loading a template from the given filename.\nSee \"fillinfile()\" for that.\n\nFor example:\n\nmy $template = Text::Template->new(\nTYPE   => 'string',\nSOURCE => 'The value is {1/0}');\n\n$template->fillin(FILENAME => 'foo.txt') or die $Text::Template::ERROR;\n\nwill die with an error that contains\n\nIllegal division by zero at at foo.txt line 1\n\n\"SAFE\"\nIf you give \"fillin\" a \"SAFE\" option, its value should be a safe compartment object from\nthe \"Safe\" package. All evaluation of program fragments will be performed in this\ncompartment. See Safe for full details about such compartments and how to restrict the\noperations that can be performed in them.\n\nIf you use the \"PACKAGE\" option with \"SAFE\", the package you specify will be placed into the\nsafe compartment and evaluation will take place in that package as usual.\n\nIf not, \"SAFE\" operation is a little different from the default. Usually, if you don't\nspecify a package, evaluation of program fragments occurs in the package from which the\ntemplate was invoked. But in \"SAFE\" mode the evaluation occurs inside the safe compartment\nand cannot affect the calling package. Normally, if you use \"HASH\" without \"PACKAGE\", the\nhash variables are imported into a private, one-use-only package. But if you use \"HASH\" and\n\"SAFE\" together without \"PACKAGE\", the hash variables will just be loaded into the root\nnamespace of the \"Safe\" compartment.\n\n\"OUTPUT\"\nIf your template is going to generate a lot of text that you are just going to print out\nagain anyway, you can save memory by having \"Text::Template\" print out the text as it is\ngenerated instead of making it into a big string and returning the string. If you supply the\n\"OUTPUT\" option to \"fillin\", the value should be a filehandle. The generated text will be\nprinted to this filehandle as it is constructed. For example:\n\n$template->fillin(OUTPUT => \\*STDOUT, ...);\n\nfills in the $template as usual, but the results are immediately printed to STDOUT. This may\nresult in the output appearing more quickly than it would have otherwise.\n\nIf you use \"OUTPUT\", the return value from \"fillin\" is still true on success and false on\nfailure, but the complete text is not returned to the caller.\n\n\"PREPEND\"\nYou can have some Perl code prepended automatically to the beginning of every program\nfragment. See \"\"PREPEND\" feature and using \"strict\" in templates\" below.\n\n\"DELIMITERS\"\nIf this option is present, its value should be a reference to a list of two strings. The\nfirst string is the string that signals the beginning of each program fragment, and the\nsecond string is the string that signals the end of each program fragment. See \"Alternative\nDelimiters\", below.\n\nIf you specify \"DELIMITERS\" in the call to \"fillin\", they override any delimiters you set\nwhen you created the template object with \"new\".\n"
                }
            ]
        },
        "Convenience Functions": {
            "content": "\"fillthisin\"\nThe basic way to fill in a template is to create a template object and then call \"fillin\" on\nit. This is useful if you want to fill in the same template more than once.\n\nIn some programs, this can be cumbersome. \"fillthisin\" accepts a string, which contains the\ntemplate, and a list of options, which are passed to \"fillin\" as above. It constructs the\ntemplate object for you, fills it in as specified, and returns the results. It returns \"undef\"\nand sets $Text::Template::ERROR if it couldn't generate any results.\n\nAn example:\n\n$Q::name = 'Donald';\n$Q::amount = 141.61;\n$Q::part = 'hyoid bone';\n\n$text = Text::Template->fillthisin( <<'EOM', PACKAGE => Q);\nDear {$name},\nYou owe me \\\\${sprintf('%.2f', $amount)}.\nPay or I will break your {$part}.\nLove,\nGrand Vizopteryx of Irkutsk.\nEOM\n\nNotice how we included the template in-line in the program by using a `here document' with the\n\"<<\" notation.\n\n\"fillthisin\" is a deprecated feature. It is only here for backwards compatibility, and may be\nremoved in some far-future version in \"Text::Template\". You should use \"fillinstring\" instead.\nIt is described in the next section.\n\n\"fillinstring\"\nIt is stupid that \"fillthisin\" is a class method. It should have been just an imported\nfunction, so that you could omit the \"Text::Template->\" in the example above. But I made the\nmistake four years ago and it is too late to change it.\n\n\"fillinstring\" is exactly like \"fillthisin\" except that it is not a method and you can omit\nthe \"Text::Template->\" and just say\n\nprint fillinstring(<<'EOM', ...);\nDear {$name},\n...\nEOM\n\nTo use \"fillinstring\", you need to say\n\nuse Text::Template 'fillinstring';\n\nat the top of your program. You should probably use \"fillinstring\" instead of \"fillthisin\".\n\n\"fillinfile\"\nIf you import \"fillinfile\", you can say\n\n$text = fillinfile(filename, ...);\n\nThe \"...\" are passed to \"fillin\" as above. The filename is the name of the file that contains\nthe template you want to fill in. It returns the result text. or \"undef\", as usual.\n\nIf you are going to fill in the same file more than once in the same program you should use the\nlonger \"new\" / \"fillin\" sequence instead. It will be a lot faster because it only has to read\nand parse the file once.\n",
            "subsections": [
                {
                    "name": "Including files into templates",
                    "content": "People always ask for this. ``Why don't you have an include function?'' they want to know. The\nshort answer is this is Perl, and Perl already has an include function. If you want it, you can\njust put\n\n{qx{cat filename}}\n\ninto your template. Voilà.\n\nIf you don't want to use \"cat\", you can write a little four-line function that opens a file and\ndumps out its contents, and call it from the template. I wrote one for you. In the template, you\ncan say\n\n{Text::Template::loadtext(filename)}\n\nIf that is too verbose, here is a trick. Suppose the template package that you are going to be\nmentioning in the \"fillin\" call is package \"Q\". Then in the main program, write\n\n*Q::include = \\&Text::Template::loadtext;\n\nThis imports the \"loadtext\" function into package \"Q\" with the name \"include\". From then on,\nany template that you fill in with package \"Q\" can say\n\n{include(filename)}\n\nto insert the text from the named file at that point. If you are using the \"HASH\" option\ninstead, just put \"include => \\&Text::Template::loadtext\" into the hash instead of importing\nit explicitly.\n\nSuppose you don't want to insert a plain text file, but rather you want to include one template\nwithin another? Just use \"fillinfile\" in the template itself:\n\n{Text::Template::fillinfile(filename)}\n\nYou can do the same importing trick if this is too much to type.\n"
                }
            ]
        },
        "Miscellaneous": {
            "content": "\"my\" variables\nPeople are frequently surprised when this doesn't work:\n\nmy $recipient = 'The King';\nmy $text = fillinfile('formletter.tmpl');\n\nThe text \"The King\" doesn't get into the form letter. Why not? Because $recipient is a \"my\"\nvariable, and the whole point of \"my\" variables is that they're private and inaccessible except\nin the scope in which they're declared. The template is not part of that scope, so the template\ncan't see $recipient.\n\nIf that's not the behavior you want, don't use \"my\". \"my\" means a private variable, and in this\ncase you don't want the variable to be private. Put the variables into package variables in some\nother package, and use the \"PACKAGE\" option to \"fillin\":\n\n$Q::recipient = $recipient;\nmy $text = fillinfile('formletter.tmpl', PACKAGE => 'Q');\n\nor pass the names and values in a hash with the \"HASH\" option:\n\nmy $text = fillinfile('formletter.tmpl', HASH => { recipient => $recipient });\n",
            "subsections": [
                {
                    "name": "Security Matters",
                    "content": "All variables are evaluated in the package you specify with the \"PACKAGE\" option of \"fillin\".\nif you use this option, and if your templates don't do anything egregiously stupid, you won't\nhave to worry that evaluation of the little programs will creep out into the rest of your\nprogram and wreck something.\n\nNevertheless, there's really no way (except with \"Safe\") to protect against a template that says\n\n{ $Important::Secret::Security::Enable = 0;\n# Disable security checks in this program\n}\n\nor\n\n{ $/ = \"ho ho ho\";   # Sabotage future uses of <FH>.\n# $/ is always a global variable\n}\n\nor even\n\n{ system(\"rm -rf /\") }\n\nso don't go filling in templates unless you're sure you know what's in them. If you're worried,\nor you can't trust the person who wrote the template, use the \"SAFE\" option.\n\nA final warning: program fragments run a small risk of accidentally clobbering local variables\nin the \"fillin\" function itself. These variables all have names that begin with $fi, so if you\nstay away from those names you'll be safe. (Of course, if you're a real wizard you can tamper\nwith them deliberately for exciting effects; this is actually how $OUT works.) I can fix this,\nbut it will make the package slower to do it, so I would prefer not to. If you are worried about\nthis, send me mail and I will show you what to do about it.\n"
                },
                {
                    "name": "Alternative Delimiters",
                    "content": "Lorenzo Valdettaro pointed out that if you are using \"Text::Template\" to generate TeX output,\nthe choice of braces as the program fragment delimiters makes you suffer suffer suffer. Starting\nin version 1.20, you can change the choice of delimiters to something other than curly braces.\n\nIn either the \"new()\" call or the \"fillin()\" call, you can specify an alternative set of\ndelimiters with the \"DELIMITERS\" option. For example, if you would like code fragments to be\ndelimited by \"[@--\" and \"--@]\" instead of \"{\" and \"}\", use\n\n... DELIMITERS => [ '[@--', '--@]' ], ...\n\nNote that these delimiters are *literal strings*, not regexes. (I tried for regexes, but it\ncomplicates the lexical analysis too much.) Note also that \"DELIMITERS\" disables the special\nmeaning of the backslash, so if you want to include the delimiters in the literal text of your\ntemplate file, you are out of luck---it is up to you to choose delimiters that do not conflict\nwith what you are doing. The delimiter strings may still appear inside of program fragments as\nlong as they nest properly. This means that if for some reason you absolutely must have a\nprogram fragment that mentions one of the delimiters, like this:\n\n[@--\nprint \"Oh no, a delimiter: --@]\\n\"\n--@]\n\nyou may be able to make it work by doing this instead:\n\n[@--\n# Fake matching delimiter in a comment: [@--\nprint \"Oh no, a delimiter: --@]\\n\"\n--@]\n\nIt may be safer to choose delimiters that begin with a newline character.\n\nBecause the parsing of templates is simplified by the absence of backslash escapes, using\nalternative \"DELIMITERS\" may speed up the parsing process by 20-25%. This shows that my original\nchoice of \"{\" and \"}\" was very bad.\n\n\"PREPEND\" feature and using \"strict\" in templates\nSuppose you would like to use \"strict\" in your templates to detect undeclared variables and the\nlike. But each code fragment is a separate lexical scope, so you have to turn on \"strict\" at the\ntop of each and every code fragment:\n\n{ use strict;\nuse vars '$foo';\n$foo = 14;\n...\n}\n\n...\n\n{ # we forgot to put `use strict' here\nmy $result = $boo + 12;    # $boo is misspelled and should be $foo\n# No error is raised on `$boo'\n}\n\nBecause we didn't put \"use strict\" at the top of the second fragment, it was only active in the\nfirst fragment, and we didn't get any \"strict\" checking in the second fragment. Then we\nmisspelled $foo and the error wasn't caught.\n\n\"Text::Template\" version 1.22 and higher has a new feature to make this easier. You can specify\nthat any text at all be automatically added to the beginning of each program fragment.\n\nWhen you make a call to \"fillin\", you can specify a\n\nPREPEND => 'some perl statements here'\n\noption; the statements will be prepended to each program fragment for that one call only.\nSuppose that the \"fillin\" call included a\n\nPREPEND => 'use strict;'\n\noption, and that the template looked like this:\n\n{ use vars '$foo';\n$foo = 14;\n...\n}\n\n...\n\n{ my $result = $boo + 12;    # $boo is misspelled and should be $foo\n...\n}\n\nThe code in the second fragment would fail, because $boo has not been declared. \"use strict\" was\nimplied, even though you did not write it explicitly, because the \"PREPEND\" option added it for\nyou automatically.\n\nThere are three other ways to do this. At the time you create the template object with \"new\",\nyou can also supply a \"PREPEND\" option, in which case the statements will be prepended each time\nyou fill in that template. If the \"fillin\" call has its own \"PREPEND\" option, this overrides\nthe one specified at the time you created the template. Finally, you can make the class method\ncall\n\nText::Template->alwaysprepend('perl statements');\n\nIf you do this, then call calls to \"fillin\" for *any* template will attach the perl statements\nto the beginning of each program fragment, except where overridden by \"PREPEND\" options to \"new\"\nor \"fillin\".\n\nAn alternative to adding \"use strict;\" to the PREPEND option, you can pass STRICT => 1 to\nfillin when also passing the HASH option.\n\nSuppose that the \"fillin\" call included both\n\nHASH   => {$foo => ''} and\nSTRICT => 1\n\noptions, and that the template looked like this:\n\n{\n$foo = 14;\n...\n}\n\n...\n\n{ my $result = $boo + 12;    # $boo is misspelled and should be $foo\n...\n}\n\nThe code in the second fragment would fail, because $boo has not been declared. \"use strict\" was\nimplied, even though you did not write it explicitly, because the \"STRICT\" option added it for\nyou automatically. Any variable referenced in the template that is not in the \"HASH\" option will\nbe an error.\n"
                },
                {
                    "name": "Prepending in Derived Classes",
                    "content": "This section is technical, and you should skip it on the first few readings.\n\nNormally there are three places that prepended text could come from. It could come from the\n\"PREPEND\" option in the \"fillin\" call, from the \"PREPEND\" option in the \"new\" call that created\nthe template object, or from the argument of the \"alwaysprepend\" call. \"Text::Template\" looks\nfor these three things in order and takes the first one that it finds.\n\nIn a subclass of \"Text::Template\", this last possibility is ambiguous. Suppose \"S\" is a subclass\nof \"Text::Template\". Should\n\nText::Template->alwaysprepend(...);\n\naffect objects in class \"Derived\"? The answer is that you can have it either way.\n\nThe \"alwaysprepend\" value for \"Text::Template\" is normally stored in a hash variable named\n%GLOBALPREPEND under the key \"Text::Template\". When \"Text::Template\" looks to see what text to\nprepend, it first looks in the template object itself, and if not, it looks in\n$GLOBALPREPEND{*class*} where *class* is the class to which the template object belongs. If it\ndoesn't find any value, it looks in $GLOBALPREPEND{'Text::Template'}. This means that objects\nin class \"Derived\" *will* be affected by\n\nText::Template->alwaysprepend(...);\n\n*unless* there is also a call to\n\nDerived->alwaysprepend(...);\n\nSo when you're designing your derived class, you can arrange to have your objects ignore\n\"Text::Template::alwaysprepend\" calls by simply putting \"Derived->alwaysprepend('')\" at the\ntop of your module.\n\nOf course, there is also a final escape hatch: Templates support a \"prependtext\" that is used\nto look up the appropriate text to be prepended at \"fillin\" time. Your derived class can\noverride this method to get an arbitrary effect.\n"
                },
                {
                    "name": "JavaScript",
                    "content": "Jennifer D. St Clair asks:\n\n> Most of my pages contain JavaScript and Stylesheets.\n> How do I change the template identifier?\n\nJennifer is worried about the braces in the JavaScript being taken as the delimiters of the Perl\nprogram fragments. Of course, disaster will ensue when perl tries to evaluate these as if they\nwere Perl programs. The best choice is to find some unambiguous delimiter strings that you can\nuse in your template instead of curly braces, and then use the \"DELIMITERS\" option. However, if\nyou can't do this for some reason, there are two easy workarounds:\n\n1. You can put \"\\\" in front of \"{\", \"}\", or \"\\\" to remove its special meaning. So, for example,\ninstead of\n\nif (br== \"n3\") {\n// etc.\n}\n\nyou can put\n\nif (br== \"n3\") \\{\n// etc.\n\\}\n\nand it'll come out of the template engine the way you want.\n\nBut here is another method that is probably better. To see how it works, first consider what\nhappens if you put this into a template:\n\n{ 'foo' }\n\nSince it's in braces, it gets evaluated, and obviously, this is going to turn into\n\nfoo\n\nSo now here's the trick: In Perl, \"q{...}\" is the same as '...'. So if we wrote\n\n{q{foo}}\n\nit would turn into\n\nfoo\n\nSo for your JavaScript, just write\n\n{q{if (br== \"n3\") {\n// etc.\n}}\n}\n\nand it'll come out as\n\nif (br== \"n3\") {\n// etc.\n}\n\nwhich is what you want.\n\nhead2 Shut Up!\n\nPeople sometimes try to put an initialization section at the top of their templates, like this:\n\n{ ...\n$var = 17;\n}\n\nThen they complain because there is a 17 at the top of the output that they didn't want to have\nthere.\n\nRemember that a program fragment is replaced with its own return value, and that in Perl the\nreturn value of a code block is the value of the last expression that was evaluated, which in\nthis case is 17. If it didn't do that, you wouldn't be able to write \"{$recipient}\" and have the\nrecipient filled in.\n\nTo prevent the 17 from appearing in the output is very simple:\n\n{ ...\n$var = 17;\n'';\n}\n\nNow the last expression evaluated yields the empty string, which is invisible. If you don't like\nthe way this looks, use\n\n{ ...\n$var = 17;\n($SILENTLY);\n}\n\ninstead. Presumably, $SILENTLY has no value, so nothing will be interpolated. This is what is\nknown as a `trick'.\n"
                },
                {
                    "name": "Compatibility",
                    "content": "Every effort has been made to make this module compatible with older versions. The only known\nexceptions follow:\n\nThe output format of the default \"BROKEN\" subroutine has changed twice, most recently between\nversions 1.31 and 1.40.\n\nStarting in version 1.10, the $OUT variable is arrogated for a special meaning. If you had\ntemplates before version 1.10 that happened to use a variable named $OUT, you will have to\nchange them to use some other variable or all sorts of strangeness will result.\n\nBetween versions 0.1b and 1.00 the behavior of the \\ metacharacter changed. In 0.1b, \\\\ was\nspecial everywhere, and the template processor always replaced it with a single backslash before\npassing the code to Perl for evaluation. The rule now is more complicated but probably more\nconvenient. See the section on backslash processing, below, for a full discussion.\n"
                },
                {
                    "name": "Backslash Processing",
                    "content": "In \"Text::Template\" beta versions, the backslash was special whenever it appeared before a brace\nor another backslash. That meant that while \"{\"\\n\"}\" did indeed generate a newline, \"{\"\\\\\"}\" did\nnot generate a backslash, because the code passed to Perl for evaluation was \"\\\" which is a\nsyntax error. If you wanted a backslash, you would have had to write \"{\"\\\\\\\\\"}\".\n\nIn \"Text::Template\" versions 1.00 through 1.10, there was a bug: Backslash was special\neverywhere. In these versions, \"{\"\\n\"}\" generated the letter \"n\".\n\nThe bug has been corrected in version 1.11, but I did not go back to exactly the old rule,\nbecause I did not like the idea of having to write \"{\"\\\\\\\\\"}\" to get one backslash. The rule is\nnow more complicated to remember, but probably easier to use. The rule is now: Backslashes are\nalways passed to Perl unchanged *unless* they occur as part of a sequence like \"\\\\\\\\\\\\{\" or\n\"\\\\\\\\\\\\}\". In these contexts, they are special; \"\\\\\" is replaced with \"\\\", and \"\\{\" and \"\\}\"\nsignal a literal brace.\n\nExamples:\n\n\\{ foo \\}\n\nis *not* evaluated, because the \"\\\" before the braces signals that they should be taken\nliterally. The result in the output looks like this:\n\n{ foo }\n\nThis is a syntax error:\n\n{ \"foo}\" }\n\nbecause \"Text::Template\" thinks that the code ends at the first \"}\", and then gets upset when it\nsees the second one. To make this work correctly, use\n\n{ \"foo\\}\" }\n\nThis passes \"foo}\" to Perl for evaluation. Note there's no \"\\\" in the evaluated code. If you\nreally want a \"\\\" in the evaluated code, use\n\n{ \"foo\\\\\\}\" }\n\nThis passes \"foo\\}\" to Perl for evaluation.\n\nStarting with \"Text::Template\" version 1.20, backslash processing is disabled if you use the\n\"DELIMITERS\" option to specify alternative delimiter strings.\n\nA short note about $Text::Template::ERROR\nIn the past some people have fretted about `violating the package boundary' by examining a\nvariable inside the \"Text::Template\" package. Don't feel this way. $Text::Template::ERROR is\npart of the published, official interface to this package. It is perfectly OK to inspect this\nvariable. The interface is not going to change.\n\nIf it really, really bothers you, you can import a function called \"TTerror\" that returns the\ncurrent value of the $ERROR variable. So you can say:\n\nuse Text::Template 'TTerror';\n\nmy $template = Text::Template->new(SOURCE => $filename);\nunless ($template) {\nmy $err = TTerror;\ndie \"Couldn't make template: $err; aborting\";\n}\n\nI don't see what benefit this has over just doing this:\n\nuse Text::Template;\n\nmy $template = Text::Template->new(SOURCE => $filename)\nor die \"Couldn't make template: $Text::Template::ERROR; aborting\";\n\nBut if it makes you happy to do it that way, go ahead.\n"
                },
                {
                    "name": "Sticky Widgets in Template Files",
                    "content": "The \"CGI\" module provides functions for `sticky widgets', which are form input controls that\nretain their values from one page to the next. Sometimes people want to know how to include\nthese widgets into their template output.\n\nIt's totally straightforward. Just call the \"CGI\" functions from inside the template:\n\n{ $q->checkboxgroup(NAME      => 'toppings',\nLINEBREAK => true,\nCOLUMNS   => 3,\nVALUES    => \\@toppings,\n);\n}\n"
                },
                {
                    "name": "Automatic preprocessing of program fragments",
                    "content": "It may be useful to preprocess the program fragments before they are evaluated. See\n\"Text::Template::Preprocess\" for more details.\n"
                },
                {
                    "name": "Automatic postprocessing of template hunks",
                    "content": "It may be useful to process hunks of output before they are appended to the result text. For\nthis, subclass and replace the \"appendtexttoresult\" method. It is passed a list of pairs with\nthese entries:\n\nhandle - a filehandle to which to print the desired output\nout    - a ref to a string to which to append, to use if handle is not given\ntext   - the text that will be appended\ntype   - where the text came from: TEXT for literal text, PROG for code\n"
                }
            ]
        },
        "HISTORY": {
            "content": "Originally written by Mark Jason Dominus, Plover Systems (versions 0.01 - 1.46)\n\nMaintainership transferred to Michael Schout <mschout@cpan.org> in version 1.47\n",
            "subsections": []
        },
        "THANKS": {
            "content": "Many thanks to the following people for offering support, encouragement, advice, bug reports,\nand all the other good stuff.\n\n*   Andrew G Wood\n\n*   Andy Wardley\n\n*   António Aragão\n\n*   Archie Warnock\n\n*   Bek Oberin\n\n*   Bob Dougherty\n\n*   Brian C. Shensky\n\n*   Chris Nandor\n\n*   Chris Wesley\n\n*   Chris.Brezil\n\n*   Daini Xie\n\n*   Dan Franklin\n\n*   Daniel LaLiberte\n\n*   David H. Adler\n\n*   David Marshall\n\n*   Dennis Taylor\n\n*   Donald L. Greer Jr.\n\n*   Dr. Frank Bucolo\n\n*   Fred Steinberg\n\n*   Gene Damon\n\n*   Hans Persson\n\n*   Hans Stoop\n\n*   Itamar Almeida de Carvalho\n\n*   James H. Thompson\n\n*   James Mastros\n\n*   Jarko Hietaniemi\n\n*   Jason Moore\n\n*   Jennifer D. St Clair\n\n*   Joel Appelbaum\n\n*   Joel Meulenberg\n\n*   Jonathan Roy\n\n*   Joseph Cheek\n\n*   Juan E. Camacho\n\n*   Kevin Atteson\n\n*   Kevin Madsen\n\n*   Klaus Arnhold\n\n*   Larry Virden\n\n*   Lieven Tomme\n\n*   Lorenzo Valdettaro\n\n*   Marek Grac\n\n*   Matt Womer\n\n*   Matt X. Hunter\n\n*   Michael G Schwern\n\n*   Michael J. Suzio\n\n*   Michaely Yeung\n\n*   Michelangelo Grigni\n\n*   Mike Brodhead\n\n*   Niklas Skoglund\n\n*   Randal L. Schwartz\n\n*   Reuven M. Lerner\n\n*   Robert M. Ioffe\n\n*   Ron Pero\n\n*   San Deng\n\n*   Sean Roehnelt\n\n*   Sergey Myasnikov\n\n*   Shabbir J. Safdar\n\n*   Shad Todd\n\n*   Steve Palincsar\n\n*   Tim Bunce\n\n*   Todd A. Green\n\n*   Tom Brown\n\n*   Tom Henry\n\n*   Tom Snee\n\n*   Trip Lilley\n\n*   Uwe Schneider\n\n*   Val Luck\n\n*   Yannis Livassof\n\n*   Yonat Sharon\n\n*   Zac Hansen\n\n*   gary at dls.net\n\nSpecial thanks to:\n\nJonathan Roy\nfor telling me how to do the \"Safe\" support (I spent two years worrying about it, and then\nJonathan pointed out that it was trivial.)\n\nRanjit Bhatnagar\nfor demanding less verbose fragments like they have in ASP, for helping me figure out the\nRight Thing, and, especially, for talking me out of adding any new syntax. These discussions\nresulted in the $OUT feature.\n",
            "subsections": [
                {
                    "name": "Bugs and Caveats",
                    "content": "\"my\" variables in \"fillin\" are still susceptible to being clobbered by template evaluation.\nThey all begin with \"fi\", so avoid those names in your templates.\n\nThe line number information will be wrong if the template's lines are not terminated by \"\\n\".\nYou should let me know if this is a problem. If you do, I will fix it.\n\nThe $OUT variable has a special meaning in templates, so you cannot use it as if it were a\nregular variable.\n\nThere are not quite enough tests in the test suite.\n"
                }
            ]
        },
        "SOURCE": {
            "content": "The development version is on github at <https://https://github.com/mschout/perl-text-template>\nand may be cloned from <git://https://github.com/mschout/perl-text-template.git>\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Please report any bugs or feature requests on the bugtracker website\n<https://github.com/mschout/perl-text-template/issues>\n\nWhen submitting a bug or request, please include a test-file or a patch to an existing test-file\nthat illustrates the bug or desired feature.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Michael Schout <mschout@cpan.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2013 by Mark Jason Dominus <mjd@cpan.org>.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
            "subsections": []
        }
    },
    "summary": "Text::Template - Expand template text with embedded Perl",
    "flags": [],
    "examples": [],
    "see_also": []
}