Codex

Text::Template::Preprocess

Section: User Contributed Perl Documentation (3pm)

Updated: 2013-02-11

Index?action=index Return to Main Contents


NAME

Text::Template::Preprocess - Expand template text with embedded Perl

VERSION

This file documents version 1.46

SYNOPSIS

DESCRIPTION

provides a new option to . If the option is supplied, it must be a reference to a preprocessor subroutine. When filling out a template, will use this subroutine to preprocess the program fragment prior to evaluating the code.
The preprocessor subroutine will be called repeatedly, once for each program fragment. The program fragment will be in . The subroutine should modify the contents of and return. will then execute contents of and insert the result into the appropriate part of the template.
objects also support a utility method, , which sets a new preprocessor for the object. This preprocessor is used for all subsequent calls to except where overridden by an explicit option. returns the previous default preprocessor function, or undefined if there wasn't one. When invoked with no arguments, returns the object's current default preprocessor function without changing it.
In all other respects, is identical to .

WHY?

One possible purpose: If your files contain a lot of JavaScript, like this:

You don't want to confuse the curly braces in the JavaScript program with executable Perl code. One strategy:
Then use . This will transform

SEE ALSO

Text::Template

AUTHOR

Mark Jason Dominus, Plover Systems

Please send questions and other remarks about this software to
You can join a very low-volume (<10 messages per year) mailing list for announcements about this package. Send an empty note to to join.
For updates, visit .

LICENSE


Index

NAME

VERSION

SYNOPSIS

DESCRIPTION

WHY?

SEE ALSO

AUTHOR

LICENSE