Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Looking for a "Template Engine"

by AltBlue (Chaplain)
on Jul 22, 2008 at 17:16 UTC ( [id://699359]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Looking for a "Template Engine"
in thread Looking for a "Template Engine"

HTML::Mason does not depend on mod_perl, but it can use it ;-)

Here's your example rendered through Mason:

#!/usr/bin/perl use strict; use warnings; use HTML::Mason; sub foo { $_[0] + $_[1] } my $template = << 'END'; This is some line. This is a line with some expression: <% foo(3,5) %> % for my $s qw(this that) { This is <% $s %> line % } This is the end END my $output; my $interp = HTML::Mason::Interp->new( out_method => \$output, in_package => __PACKAGE__, ); my $comp = $interp->make_component( comp_source => $template ); $interp->exec($comp); print $output;

You mentioned you don't care too much about the syntax, that's why I preferred do not show you how to override Mason's default syntax. Check out http://masonhq.com/docs/manual/ if you're interested.

--
altblue.

Replies are listed 'Best First'.
Re^4: Looking for a "Template Engine"
by rovf (Priest) on Jul 23, 2008 at 08:30 UTC

    Thank you for providing the example!!!

    -- 
    Ronald Fischer <ynnor@mm.st>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-25 09:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found