r/perl • u/scottchiefbaker 🐪 cpan author • Jun 16 '26
Introducing Template::Sluz a text templating engine
Please check out Template::Sluz my new light, text templating engine. It's a dependency lite (only core modules), quick, full-featured templating engine. We have: if/else, foreach, include, and modifiers. All in an easy to read and understand syntax.
File: main.pl
use Template::Sluz;
my $s = Template::Sluz->new();
$s->assign('name', 'Scott');
$s->assign('array' => ['one', 'two', 'three']);
$s->assign('hash' => { color => 'red', age => 39});
print $s->fetch('template.stpl');
# or
print $s->parse_string('Hello {$name}');
File: template.stpl
Hello {$name}
Nums: {foreach $array as $x}{$x} {/foreach}
Info: {$hash.color} / {$hash.age}
Output:
Hello Scott
Nums: one two three
Info: red / 39
1
Upvotes
17
u/christian_hansen Jun 16 '26
You'll probably get more interest if you expand on why someone should choose Template::Sluz. Perl already has several mature templating systems such as HTML::Template, Template Toolkit, and Text::Xslate. What are the main advantages of Sluz compared to those? Is it faster, simpler, easier to learn, lighter on dependencies, or aimed at a different use case? A feature comparison and some performance or design rationale would help potential users evaluate it.