The Template Toolkit can use callbacks. I'm not sure exactly what you want to do, but this demonstrates the general idea.
#!/usr/bin/perl + use strict; use warnings; use Template; + my $tt = Template->new; + my $data = { word => 'callbacks', emphasise => \&emphasise }; + $tt->process(\*DATA, $data) || die $tt->error(), "\n"; + sub emphasise { return "** @_ **"; } + __DATA__ This is a template. It includes [% emphasise(word) %]
--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg


In reply to Re: Callbacks and templates. by davorg
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":