Text::...leQuote(3pm)
π NAME π
Text::MicroMason::DoubleQuote β a whole Minimalist Interpolation Engine, no cap β¨
(also hii this page lives in the User Contributed Perl Documentation section, so you know it's the real community-made stuff π«Ά)
πΈ SYNOPSIS πΈ
okay so bestie, do not use this class all by itself. You pass its name in to get mixed in, like a little sprinkle on top:
use Text::MicroMason;
my $mason = Text::MicroMason::Base->new( -DoubleQuote );
and then your templates can be written using Perl's own double-quote interpolation syntax π
$coderef = $mason->compile( text => 'Hello $ARGS{name}!' );
print $coderef->( name => 'World' );
literally that's it, it's giving effortless π
π¦ DESCRIPTION π¦
Text::MicroMason::DoubleQuote uses Perl's double-quoting interpolation as a minimalist syntax for templating. Iconic behaviour, honestly.
And like, of course you don't need this module for simple cases of interpolation β nobody's forcing you π β but if you're already using the MicroMason framework to process template files from disk, then this module should allow you to make your simplest templates run even faster. speed. slay.
β¨ embedding the fancy stuff β¨
To embed values other than simple scalars in a double-quoted expression, you can use the ${ expr } syntax. For example, you can interpolate a function call with "${ \( time() ) }" or "@{[mysub(1,2,3)]}".
As noted in perldaq4, "this is fraught with quoting and readability problems, but it is possible." β and bestie, they were NOT lying π
β οΈ In particular, this can quickly become a mess once you start adding loops or conditionals. If you do find yourself making use of this feature, please consider switching to one of the more powerful template syntaxes like Text::MicroMason::HTMLMason. that's the glow-up, trust π
π SEE ALSO π
- To refer to arguments as
$namerather than as$ARGS{name}, see Text::MicroMason::PassVariables. cleaner, cuter, obsessed π - For an overview of this distribution, see Text::MicroMason. π
- This is a subclass intended for use with Text::MicroMason::Base. π§
- For distribution, installation, support, copyright and license information, see Text::MicroMason::Docs::ReadMe. π
and that's the whole vibe check, bestie π this page came from perl v5.36.0, dated 2023-08-10 β go forth and interpolate responsibly, mwah π β¨
π¦ 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