Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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 if you're interested.


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

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-06-17 16:45 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.