1 2Text::Template v1.46 3 4This is a library for generating form letters, building HTML pages, or 5filling in templates generally. A `template' is a piece of text that 6has little Perl programs embedded in it here and there. When you 7`fill in' a template, you evaluate the little programs and replace 8them with their values. 9 10Here's an example of a template: 11 12 Dear {$title} {$lastname}, 13 14 It has come to our attention that you are delinquent in your 15 {$monthname[$last_paid_month]} payment. Please remit 16 ${sprintf("%.2f", $amount)} immediately, or your patellae may 17 be needlessly endangered. 18 19 Love, 20 21 Mark "{nickname(rand 20)}" Dominus 22 23 24The result of filling in this template is a string, which might look 25something like this: 26 27 Dear Mr. Gates, 28 29 It has come to our attention that you are delinquent in your 30 February payment. Please remit 31 $392.12 immediately, or your patellae may 32 be needlessly endangered. 33 34 35 Love, 36 37 Mark "Vizopteryx" Dominus 38 39You can store a template in a file outside your program. People can 40modify the template without modifying the program. You can separate 41the formatting details from the main code, and put the formatting 42parts of the program into the template. That prevents code bloat and 43encourages functional separation. 44 45You can fill in the template in a `Safe' compartment. This means that 46if you don't trust the person who wrote the code in the template, you 47won't have to worry that they are tampering with your program when you 48execute it. 49 50---------------------------------------------------------------- 51 52Text::Template was originally released some time in late 1995 or early 531996. After three years of study and investigation, I rewrote it from 54scratch in January 1999. The new version, 1.0, was much faster, 55delivered better functionality and was almost 100% backward-compatible 56with the previous beta versions. 57 58I have added a number of useful features and conveniences since the 591.0 release, while still retaining backward compatibility. With one 60merely cosmetic change, the current version of Text::Template passes 61the test suite that the old beta versions passed. 62 63