Revision History

Back to Text::Templet

2.9

  • Bugfix: package context is now honored during recursive calls to Templet().

2.8

  • Added Use() function and HeaderCallback callback.
  • Bugfix: multiple warnings now correctly propagated.
  • Processing stops and die() is called if a code section contains errors.

2.5

  • Asterisk labels to simplify conditional syntax.
  • License changed from GPL 2 to Perl Artistic License.
  • Minor performance improvements.

2.3

  • In non-void calling context Templet will return the processed template instead of printing it.

2.1

  • Magic is listed on CPAN as Text::Templet, and from now on this will be the module’s official name. This release is functionally identical to 1.16, except that it has documentation embedded into the module for CPAN distribution. And a different name, obviously, so now to include it in your program you need to use Text::Templet instead of use Magic.
  • Magic was using some trivially named variables internally, notably $i, meaning that if you had a variable named $i in your template, it would use the value of the internal variable instead of the variable declared in your script. I gave more meaningful names to $i and most other internal variables, and listed them all in the documentation.

1.16

  • I made Magic() re-entry safe, which allows parts of the target text to be
    generated by a separate Magic() call enclosed in a subroutine called from another Magic template.
    That subroutine could then be shared among different templates, enabling “include”-type
    functionality. It could be considered a feature, but it really is a bugfix as I could’ve easily
    made it re-entrant from the beginning, but was too lazy :)

1.14

  • I converted Magic to a Perl module as I figured out how to switch to the namespace of the package Magic was called from so the package variables could be accessed without having to qualify them (i.e. $magic vs. $Package::magic). This works much better with mod_perl as now you no longer have to put all your pages into package main in order to use unqualified names and having to invent unique names for functions throughout the entire site! Additionally, now you can tuck it away into your libraries and reuse it for multiple applications.

1.13

  • Implemented proper handling of warnings thrown from template sections and writing them nicely formatted into the error log. Now Magic tells you on which line of the template the problematic section begins. It gives you the line number in the template text and also the line number of your perl file, if you embedded the template into your code using “quote here” construct.

1.12

  • Fixed a bug introduced by the change in 1.11 which caused template processing to stop when a code section returned undef, not just when an error occured.

1.11

  • It turned out that in many situations an error in code section would lead to an infinite loop. Now Magic will stop when processing of a code section produces an error.

1.10

  • Bugfix – Magic would post a warning if a code or text section returned undef regardless of whether it was caused by an error or not.

1.9

  • Fixed a bug that caused duplicate labels in skipped sections of template not being reported. For example, neither of the following fragments would trigger a warning about a duplicate label ‘DUP’:
    <% “SKIP_DUP” if 1 %><%DUP%><%DUP%><%SKIP_DUP%> or <% “SKIP_DUP” if 1 %><%DUP%><%SKIP_DUP%><%DUP%>

1.8

  • Changed label name syntax – now it must begin with a letter or an underscore. This resolved an issue of warnings being issued about non-existent label ’1′ when a code section returned a boolean value. For example, the following useful code would produce this warning: <% ‘SKIP_HERE’ unless $do_not_skip %> when $do_not_skip contained 1.

1.7

  • Fixed a bug in diagnostics code that caused incorrect duplicate label warnings issued.

1.6

  • New functionality – implicit labels appended to the template, “_” at the beginning and “END” at the end. This fixes the issue of the template text prior to the first <% %> section being ignored.
  • Added a diagnostic message warning about duplicate labels.
  • Added a diagnostic message warning about a code section returning a nonexistent label.
  • Now code sections can span multiple lines.
  • Fixed a bug – the code was calling $Q->print() for output assuming that $Q was a reference to an instance of CGI object. Changed that to a simple print() call.

1.4

  • Added diagnostic logging. Magic will call warn() with an error message and will include the section of the template that caused the error.
  • Fixed a bug that caused Magic to post a message to the error log every time a code section returned undef.

1.3

  • Initial revision

Feel free to send me your questions and feedback at