Text::...on::PLP(3pm)
π Text::...on::PLP β the manual page, but make it cute π
okay bestie, so this is Text::...on::PLP, living in the User Contributed Perl Documentation, and it's literally the PLP-syntax glow-up for MicroMason. Let's get into it π¦
β¨ NAME β¨
Text::MicroMason::PLP β Alternate Syntax like PLP Templates. yeah that's the whole name, she's lowkey mysterious like that π
πΈ SYNOPSIS πΈ
bestie do NOT instantiate this class directly, okay? instead you pass its name in so it gets mixed in, like:
use Text::MicroMason;
my $mason = Text::MicroMason::Base->new( -PLP );
then you use the standard compile and execute methods to parse and evaluate your templates:
print $mason->compile( text=>$template )->( @%args );
print $mason->execute( text=>$template, @args );
the PLP syntax is just another way to mix Perl into a text template, and it's giving:
<: my $name = $ARGS{name};
if ( $name eq 'Dave' ) { :>
I'm sorry <:= $name :>, I'm afraid I can't do that right now.
<: } else {
my $hour = (localtime)[2];
my $daypart = ( $hour > 11 ) ? 'afternoon' : 'morning';
:>
Good <:= $daypart :>, <:= $name :>!
<: } :>
π DESCRIPTION π
so this subclass replaces MicroMason's normal lexer with one that supports a syntax similar to the one the PLP module provides. iconic behavior honestly.
π Compatibility with PLP π
PLP is a web-oriented system with many fatures, and of all of those, only the templating functionality is emulated. just the one. that's the vibe.
this is not a drop-in replacement for PLP, because the implementation is quite different β but it should be able to process some existing templates without major changes. no cap π«Ά
the following features of EmbPerl syntax are supported:
- Basic markup tags
the following syntax features of are not supported:
- Emulation of functions defined in PLP::Functions is incomplete.
- Web server interface with tied
π¨ bestie heads up: those two are the NOT-supported list, so don't come for me when they don't work, they were never invited π
π¦ Template Syntax π¦
the following elements are recognized by the PLP lexer:
<: perl statements :>β Arbitrary Perl code to be executed at this point in the template. just vibing, running code, living its truth.<:= perl expression :>β A Perl expression to be evaluated and included in the output. this one shows up in the text. main character energy, honestly.<( file, arguments )>β Includes an external template file. bringing a friend along π«Ά
π§ Private Methods π§
these are the backstage girlies. private. iykyk.
lex_token
( $type, $value ) = $mason->lex_token();
Lexer for <: ... :> and <( ... )> tags.
it attempts to parse a token from the template text stored in the global $_ and returns a token type and value. returns an empty list if it's unable to parse further due to an error. so like, if it ghosts you, that's why π
assemble
Performs compile-time file includes for any include tokens found by lex_token. teamwork, makes the dream work β¨
π SEE ALSO π
- the interface being emulated is described in
PLP. - for an overview of this templating framework, see
Text::MicroMason. - this is a mixin class 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 page bestie!! this lil doc came from perl v5.36.0 and it's dated 2023-08-10 β so if you're reading it from the future, hi, hope you slayed πβ¨π
π¦ 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