@# A test program for Temple @# starts with a couple of comments @# The language is very simple -- everything except the "@" character @# gets passed to the output verbatim: Verbatim. @# The "@" starts a control sequence. Arguments of control sequences @# are either everything to the end of the current line (as in case @# of the comment command you are looking at) balanced parenthesized @# string. @# @# If we want to ignore and end of line character, just prefix it by "@": This line @ won't be broken@ . @# If you want to write the "@" character, just write it twice: @@ @# You can embed any perl code in your text (use the "out" function to @# write to the templater's output): @[foreach $x (1..10) { out "$x "; } ] @# Or if you use @{...}, then the value of the last expression executed @# gets printed automatically: @{"1+2+3 = " . (1+2+3)} @# You can also interpolate perl variables in the T:: namespace by using @$variable: I was run as @$0. @# It is possible to call any perl functions @# (any result other than undef will be printed automatically) @# Use `out' to write to the output stream @out("One", "Two", "Three\n") @# Or do the same with parameters running up to the end of the line: @out "Four", "Five", "Six\n" @# Of course you can define your own functions (they live in the T:: namespace) @[ sub quork($) { my ($arg) = @_; return "Thus quorkth the Penguin: $arg"; } ] @quork("404!") @# There are also some conditionals (you can use any perl expressions): @if 1 @if 0 one @elif 0 two @elif 1 three @fi @else four @fi @# Or you can use the parenthesized form: @if(0)ONE@else()TWO@fi()THREE @# To include another file (and possibly change some variables), use: @include("test2", "a" => "HOWDY", "b" => "HULLO", "c" => "AHOY") @include "test2", "a" => "howdy", "b" => "hullo", "c" => "ahoy" @# And to load a perl file: @load "test3" @# This one is tricky: @out("z\n", < 'Once', 'time' => 'midnight' } ); ] @# We are done: Finis.