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: talk is required, regexvars is deprecated, and every vars entry 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