I didn't know you could do it this way. Neat.

Anyway, TIMTOWTDI, even for Template-Toolkit. Here's the same demo modified to use a filter, which is like a "program" (thus, a sub) you pipe the data through.

#!/usr/bin/perl -w use strict; use warnings; use Template; my $tt = Template->new(FILTERS => { emphasise => \&emphasise }); my $data = { word => 'callbacks' }; $tt->process(\*DATA, $data) || die $tt->error(), "\n"; sub emphasise { return "** @_ **"; } __DATA__ This is a template. It includes [% word | emphasise %]

In reply to Re(2): Callbacks and templates. by bart
in thread Callbacks and templates. by LukeyBoy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":