SRevie...emplate(3pm)
β¨ NAME β¨
SReview::Template β bestie, this lil module takes a string or a whole file and applies your changes to it π
πΈ SYNOPSIS πΈ
use SReview::Template;
use SReview::Talk;
my $talk = SReview::Talk->new(...);
my $template = SReview::Template->new(talk => $talk, vars => { foo => "bar" }, regexvars => {"@FOO@" => "foo"});
my $processed = $template->string("The @FOO@ is <%== $foo %>, and the talk is titled <%== $talk->title %>");
# $processed now contains "The foo is bar, and the talk is titled ..."
# (with the actual talk title there)
$template->file("inputfile.txt", "outputfile.txt"
(yes bestie, that last line is exactly how it is, no cap π)
π¦ DESCRIPTION π¦
Okay so <pink>SReview::Template</pink> is a cute lil wrapper around Mojo::Template β it's giving "middle manager for templates" and honestly? It slays. Every single variable you pass in through the vars parameter gets handed over to Mojo::Template as a named variable. Periodt. π
But wait, there's lore. π« Back in the day, some bits of SReview were out here doing that old-school sed-like search-and-replace templating, and for backwards compatibility this module still supports it (like, for example, SReview::Template::SVG has a few of those hanging around). However β and listen closely bestie β those are now deprecated. π Do not be out here using them for new stuff. The $talk variable and Mojo::Template-style templates are the moment now. Use those instead. iykyk β¨
π ATTRIBUTES π
SReview::Template objects support the following attributes, and yes they all ate:
π talk
An SReview::Talk object for the talk that this template is for.
Required. Like, actually required. It gets passed on to the template as the $talk variable, so if you skip it the whole vibe check fails. π
π vars
Extra Mojo::Template variables to be made available to the template. Sprinkle them in like glitter. β¨
π regexvars
Variables to be replaced by search-and-replace. (This is the deprecated-era energy we talked about, but it's still here, still doing its thing. π§)
π METHODS π
π file
A method to process an input file through the templating engine and drop the result into an output file. So iconic.
Takes to arguments: the name of the input file, followed by the name of the output file. (Two arguments, bestie β the manpage just says "to" and honestly? relatable typo energy. π)
Is implemented in terms of the "string" method β so like, it's built on top of the string one, no separate machinery, no drama. π«Ά
π string
A function to process a string, passed as the only argument. Returns the result of the template function. That's it, that's the whole gig. Simple, clean, main character energy. π
π quick reminder bestie:talkis required,regexvarsis deprecated, and everyvarsentry becomes a named variable in Mojo::Template. No guessing, that's just facts fr fr.
And that's a wrap, gorgeous! π This page came to you from the SReview::Template(3pm) page in the User Contributed Perl Documentation, riding on perl v5.40.1, dated 2026-02-15. Stan a documented module. πβ¨πΈπ¦π
π¦ where this page comes from
- ubuntu resolute: sreview-common 0.12.0-1
- ubuntu stonking: sreview-common 0.12.0-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms