Blame external/perl/Text-Template-1.46/README

Packit c4476c
Packit c4476c
Text::Template v1.46
Packit c4476c
Packit c4476c
This is a library for generating form letters, building HTML pages, or
Packit c4476c
filling in templates generally.  A `template' is a piece of text that
Packit c4476c
has little Perl programs embedded in it here and there.  When you
Packit c4476c
`fill in' a template, you evaluate the little programs and replace
Packit c4476c
them with their values.  
Packit c4476c
Packit c4476c
Here's an example of a template:
Packit c4476c
Packit c4476c
	Dear {$title} {$lastname},
Packit c4476c
Packit c4476c
	It has come to our attention that you are delinquent in your
Packit c4476c
	{$monthname[$last_paid_month]} payment.  Please remit
Packit c4476c
	${sprintf("%.2f", $amount)} immediately, or your patellae may
Packit c4476c
	be needlessly endangered.
Packit c4476c
Packit c4476c
			Love,
Packit c4476c
Packit c4476c
			Mark "{nickname(rand 20)}" Dominus
Packit c4476c
Packit c4476c
Packit c4476c
The result of filling in this template is a string, which might look
Packit c4476c
something like this:
Packit c4476c
Packit c4476c
	Dear Mr. Gates,
Packit c4476c
Packit c4476c
	It has come to our attention that you are delinquent in your
Packit c4476c
	February payment.  Please remit
Packit c4476c
	$392.12 immediately, or your patellae may
Packit c4476c
	be needlessly endangered.
Packit c4476c
Packit c4476c
Packit c4476c
			Love,
Packit c4476c
Packit c4476c
			Mark "Vizopteryx" Dominus
Packit c4476c
Packit c4476c
You can store a template in a file outside your program.  People can
Packit c4476c
modify the template without modifying the program.  You can separate
Packit c4476c
the formatting details from the main code, and put the formatting
Packit c4476c
parts of the program into the template.  That prevents code bloat and
Packit c4476c
encourages functional separation.
Packit c4476c
Packit c4476c
You can fill in the template in a `Safe' compartment.  This means that
Packit c4476c
if you don't trust the person who wrote the code in the template, you
Packit c4476c
won't have to worry that they are tampering with your program when you
Packit c4476c
execute it.  
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
Packit c4476c
Text::Template was originally released some time in late 1995 or early
Packit c4476c
1996.  After three years of study and investigation, I rewrote it from
Packit c4476c
scratch in January 1999.  The new version, 1.0, was much faster,
Packit c4476c
delivered better functionality and was almost 100% backward-compatible
Packit c4476c
with the previous beta versions.
Packit c4476c
Packit c4476c
I have added a number of useful features and conveniences since the
Packit c4476c
1.0 release, while still retaining backward compatibility.  With one
Packit c4476c
merely cosmetic change, the current version of Text::Template passes
Packit c4476c
the test suite that the old beta versions passed.
Packit c4476c
Packit c4476c
Questions or comments should be addressed to
Packit c4476c
mjd-perl-template+@plover.com.  This address goes directly to me, and
Packit c4476c
not to anyone else; it is not a mailing list address.
Packit c4476c
Packit c4476c
To receive occasional announcements of new versions of T::T, send an
Packit c4476c
empty note to mjd-perl-template-request@plover.com.  This mailing list
Packit c4476c
is not for discussion; it is for announcements only.  Therefore, there
Packit c4476c
is no address for sending messages to the list.
Packit c4476c
Packit c4476c
You can get the most recent version of Text::Template, news, comments,
Packit c4476c
and other collateral information from
Packit c4476c
<URL:http://www.plover.com/~mjd/perl/Template/>.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
Packit c4476c
What's new in v1.46 since v1.44:
Packit c4476c
Packit c4476c
        Thanks to Rik Signes, there is a new
Packit c4476c
        Text::Template->append_text_to_output method, which
Packit c4476c
        Text::Template always uses whenever it wants to emit output.
Packit c4476c
        You can subclass this to get control over the output, for
Packit c4476c
        example for postprocessing.
Packit c4476c
Packit c4476c
        A spurious warning is no longer emitted when the TYPE
Packit c4476c
        parameter to ->new is omitted.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
What's new in v1.44 since v1.43: 
Packit c4476c
Packit c4476c
This is a maintentance release.  There are no feature changes.
Packit c4476c
Packit c4476c
        _scrubpkg, which was responsible for eptying out temporary
Packit c4476c
        packages after the module had done with them, wasn't always
Packit c4476c
        working; the result was memory-leaks in long-running
Packit c4476c
        applications.  This should be fixed now, and there is a test
Packit c4476c
        in the test suite for it.
Packit c4476c
Packit c4476c
        Minor changes to the test suite to prevent spurious errors.
Packit c4476c
Packit c4476c
        Minor documentation changes.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
What's new in v1.43 since v1.42:
Packit c4476c
Packit c4476c
        The ->new method now fails immediately and sets
Packit c4476c
        $Text::Template::ERROR if the file that is named by a filename
Packit c4476c
        argument does not exist or cannot be opened for some other
Packit c4476c
        reason.  Formerly, the constructor would succeed and the
Packit c4476c
        ->fill_in call would fail.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
Packit c4476c
What's new in v1.42 since v1.41:
Packit c4476c
Packit c4476c
This is a maintentance release.  There are no feature changes.
Packit c4476c
Packit c4476c
        Fixed a bug relating to use of UNTAINT under perl 5.005_03 and
Packit c4476c
        possibly other versions.
Packit c4476c
Packit c4476c
        Taint-related tests are now more comprehensive.
Packit c4476c
----------------------------------------------------------------
Packit c4476c
Packit c4476c
What's new in v1.41 since v1.40:
Packit c4476c
Packit c4476c
This is a maintentance release.  There are no feature changes.
Packit c4476c
Packit c4476c
        Tests now work correctly on Windows systems and possibly on
Packit c4476c
        other non-unix systems.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
Packit c4476c
What's new in v1.40 since v1.31:
Packit c4476c
Packit c4476c
        New UNTAINT option tells the module that it is safe to 'eval'
Packit c4476c
        code even though it has come from a file or filehandle.
Packit c4476c
Packit c4476c
        Code added to prevent memory leaks when filling many
Packit c4476c
        templates.  Thanks to Itamar Almeida de Carvalho.
Packit c4476c
Packit c4476c
        Bug fix:  $OUT was not correctly initialized when used in
Packit c4476c
        conjunction with SAFE.
Packit c4476c
Packit c4476c
        You may now use a glob ref when passing a filehandle to the
Packit c4476c
        ->new funcion.  Formerly, a glob was reuqired.
Packit c4476c
Packit c4476c
        New subclass:  Text::Template::Preprocess.  Just like
Packit c4476c
        Text::Template, but you may supply a PREPROCESS option in the
Packit c4476c
        constructor or the fill_in call; this is a function which
Packit c4476c
        receives each code fragment prior to evaluation, and which may
Packit c4476c
        modify and return the fragment; the modified fragment is what
Packit c4476c
        is evaluated.
Packit c4476c
Packit c4476c
        Error messages passed to BROKEN subroutines will now report
Packit c4476c
        the correct line number of the template at which the error
Packit c4476c
        occurred:
Packit c4476c
Packit c4476c
                Illegal division by zero at template line 37.
Packit c4476c
Packit c4476c
        If the template comes from a file, the filename will be
Packit c4476c
        reported as well:
Packit c4476c
Packit c4476c
                Illegal division by zero at catalog.tmpl line 37.
Packit c4476c
Packit c4476c
Packit c4476c
        INCOMPATIBLE CHANGE:
Packit c4476c
Packit c4476c
        The format of the default error message has changed.  It used
Packit c4476c
        to look like:
Packit c4476c
Packit c4476c
                Program fragment at line 30 delivered error ``Illegal division by zero''
Packit c4476c
Packit c4476c
        It now looks like:
Packit c4476c
Packit c4476c
                Program fragment delivered error ``Illegal division by zero at catalog.tmpl line 37''
Packit c4476c
Packit c4476c
        Note that the default message used to report the line number
Packit c4476c
        at which the program fragment began; it now reports the line
Packit c4476c
        number at which the error actually occurred.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
What's new in v1.31 since v1.23:
Packit c4476c
Packit c4476c
	Just bug fixes---fill_in_string was failing.  Thanks to 
Packit c4476c
        Donald L. Greer Jr. for the test case.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
What's new in v1.23 since v1.22:
Packit c4476c
Packit c4476c
	Small bug fix:  DELIMITER and other arguments were being
Packit c4476c
	ignored in calls to fill_in_file and fill_this_in.  (Thanks to
Packit c4476c
	Jonathan Roy for reporting this.)
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
What's new in v1.22 since v1.20:
Packit c4476c
Packit c4476c
	You can now specify that certain Perl statements be prepended
Packit c4476c
	to the beginning of every program fragment in a template,
Packit c4476c
	either per template, or for all templates, or for the duration
Packit c4476c
	of only one call to fill_in.  This is useful, for example, if
Packit c4476c
	you want to enable `strict' checks in your templates but you
Packit c4476c
	don't want to manually add `use strict' to the front of every
Packit c4476c
	program fragment everywhere.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
What's new in v1.20 since v1.12:
Packit c4476c
Packit c4476c
	You can now specify that the program fragment delimiters are
Packit c4476c
	strings other than { and }.  This has three interesting
Packit c4476c
	effects: First, it changes the delimiter strings.  Second, it
Packit c4476c
	disables the special meaning of \, so you have to be really,
Packit c4476c
	really sure that the delimiters will not appear in your
Packit c4476c
	templates.  And third, because of the simplifications
Packit c4476c
	introduced by the elimination of \ processing, template
Packit c4476c
	parsing is 20-25% faster.
Packit c4476c
Packit c4476c
	See the manual section on `Alternative Delimiters'.
Packit c4476c
Packit c4476c
	Fixed bug having to do with undefined values in HASH options.
Packit c4476c
	In particular, Text::Template no longer generates a warning if
Packit c4476c
	you try to give a variable an undefined value.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
Packit c4476c
What's new in v1.12 since v1.11:
Packit c4476c
Packit c4476c
	I forgot to say that Text::Template ISA Exporter, so the
Packit c4476c
	exported functions never got exported.  Duhhh!
Packit c4476c
Packit c4476c
	Template TYPEs are now case-insensitive.  The `new' method now
Packit c4476c
	diagnoses attempts to use an invalid TYPE.
Packit c4476c
Packit c4476c
	More tests for these things.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
Packit c4476c
What's new in v1.11 since v1.10:
Packit c4476c
Packit c4476c
	Fixed a bug in the way backslashes were processed.  The 1.10
Packit c4476c
	behavior was incompatible with the beta versions and was also
Packit c4476c
	inconvenient.  (`\n' in templates was replaced with `n' before
Packit c4476c
	it was given to Perl for evaluation.)  The new behavior is
Packit c4476c
	also incompatible with the beta versions, but it is only a
Packit c4476c
	little bit incompatible, and it is probbaly better.
Packit c4476c
Packit c4476c
	Documentation for the new behavior, and tests for the bug.
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
Packit c4476c
What's new in v1.10 since v1.03:
Packit c4476c
Packit c4476c
	New OUTPUT option delivers template results directly to a
Packit c4476c
	filehandle instead of making them into a string.  Saves space
Packit c4476c
	and time. 
Packit c4476c
Packit c4476c
	PACKAGE and HASH now work intelligently with SAFE.
Packit c4476c
Packit c4476c
	Fragments may now output data directly to the template, rather
Packit c4476c
	than having to arrange to return it as a return value at the
Packit c4476c
	end.  This means that where you used to have to write this:
Packit c4476c
Packit c4476c
			{ my $blist = '';
Packit c4476c
		          foreach $i (@items) {
Packit c4476c
		            $blist .= qq{  * $i\n};
Packit c4476c
		          }    
Packit c4476c
		          $blist;
Packit c4476c
		        } 
Packit c4476c
Packit c4476c
	You can now write this instead, because $OUT is special.
Packit c4476c
Packit c4476c
			{ foreach $i (@items) {
Packit c4476c
		            $OUT.= "  * $i\n";
Packit c4476c
		          }    
Packit c4476c
		        } 
Packit c4476c
Packit c4476c
	(`A spoonful of sugar makes the medicine go down.')
Packit c4476c
Packit c4476c
	Fixed some small bugs.  Worked around a bug in Perl that does
Packit c4476c
	the wrong thing with $x = <Y> when $x contains a glob.
Packit c4476c
Packit c4476c
	More documentation.  Errors fixed.
Packit c4476c
Packit c4476c
	Lots more tests.  
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
Packit c4476c
What's new in v1.03 since v1.0:
Packit c4476c
Packit c4476c
	Code added to support HASH option to fill_in.
Packit c4476c
	(Incl. `_gensym' function.)
Packit c4476c
	
Packit c4476c
	Documentation for HASH.
Packit c4476c
	
Packit c4476c
	New test file for HASH.
Packit c4476c
	
Packit c4476c
	Note about failure of lexical variables to propagate into
Packit c4476c
 	templates.  Why does this surprise people?
Packit c4476c
	
Packit c4476c
	Bug fix: program fragments are evaluated in an environment with
Packit c4476c
 	`no strict' by default.  Otherwise, you get a lot of `Global
Packit c4476c
 	symbol "$v" requires explicit package name' failures.  Why didn't
Packit c4476c
 	the test program pick this up?  Because the only variable the test
Packit c4476c
 	program ever used was `$a', which is exempt.  Duhhhhh.
Packit c4476c
	
Packit c4476c
	Fixed the test program.
Packit c4476c
	
Packit c4476c
	Various minor documentation fixes.
Packit c4476c
Packit c4476c
Packit c4476c
Packit c4476c
----------------------------------------------------------------
Packit c4476c
Packit c4476c
Improvements of 1.0 over the old 0.1beta:
Packit c4476c
Packit c4476c
New features:
Packit c4476c
Packit c4476c
      At least twice as fast 
Packit c4476c
Packit c4476c
      Better support for filling out the same template more than once 
Packit c4476c
Packit c4476c
      Now supports evaluation of program fragments in Safe
Packit c4476c
      compartments. (Thanks, Jonathan!)  
Packit c4476c
Packit c4476c
      Better argument syntax 
Packit c4476c
Packit c4476c
      More convenience functions 
Packit c4476c
Packit c4476c
      The parser is much better and simpler. 
Packit c4476c
Packit c4476c
      Once a template is parsed, the parsed version is stored so that
Packit c4476c
      it needn't be parsed again.  
Packit c4476c
Packit c4476c
      BROKEN function behavior is rationalized. You can now pass an
Packit c4476c
      arbitrary argument to your BROKEN function, or return a value
Packit c4476c
      from it to the main program.  
Packit c4476c
Packit c4476c
      Documentation overhauled. 
Packit c4476c