Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re(2): Callbacks and templates.

by bart (Canon)
on Apr 13, 2004 at 09:13 UTC ( [id://344667]=note: print w/replies, xml ) Need Help??


in reply to Re: Callbacks and templates.
in thread Callbacks and templates.

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 %]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://344667]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-24 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found