Text::...riables(3pm)
π NAME π
Text::MicroMason::PassVariables β it passes your template data in as variables β¨
(oh and btw the page header literally says Text::...riables(3pm) β truncated like that, no cap, it's giving mystery π but we know who she is)
β¨ SYNOPSIS β¨
okay bestie, lowkey important: don't use this class directly, you pass its name in to get mixed in π«Ά
use Text::MicroMason;
my $mason = Text::MicroMason->new( -PassVariables );
then you use the standard compile and execute methods to parse and evaluate templates:
print $mason->compile( text=>$template )->( 'name'=>'Dave' );
print $mason->execute( text=>$template, 'name'=>'Dave' );
and now your templates can access their arguments as global variables π
Welcome, <% $name %>!
π¦ DESCRIPTION π¦
Like Text::Template, this package passes in template arguments as package variables. fr fr. so like, if you pass in an argument list of "foo => 23", it will set the variable $foo in the package your template is compiled in. which means your template code can just refer to $name instead of $ARGS{name} β so much cleaner, obsessed π
The strict pragma is disabled to facilitate these variable references. yeah, she's living dangerously, that's the whole point π
Caution: bestie please read this part π β this approach has some drawbacks, including the risk of clobbering global variables used for other purposes. It is included primarily to allow theTextTemplatemodule to emulate the behavior ofText::Template, and for quick-and-dirty simple templates where succinctness is more important than robustness. it's giving main character energy but also chaos, iykyk π
π Supported Attributes π
packageβ target package namespace. defaults toText::MicroMason::Commandsπ
π§ Private Methods π§
assembler_rules()β adds Perl fragments to handle package and symbol table munging β¨assemble()β modifies the Perl subroutine to embed the target package namespace π₯install_args_hash()β performs symbol table munging to transfer the contents of an arguments hash into variables in a target namespace π«
πΈ SEE ALSO πΈ
the interface being emulated is described in Text::Template.
for an overview of this whole templating framework, see Text::MicroMason.
this is a mixin class intended for use with Text::MicroMason::Base.
for distribution, installation, support, copyright and license info, see Text::MicroMason::Docs::ReadMe β
okay that's the whole page bestie, you ate π
β¨ this was Text::...riables(3pm) from the User Contributed Perl Documentation, built against perl v5.36.0 and dated 2023-08-10 β mwah, go slay some templates ππ¦π
π¦ where this page comes from
- debian trixie: libtext-micromason-perl 2.23-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-micromason-perl 2.23-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-micromason-perl 2.23-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-micromason-perl 2.23-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms