Text::...erPages(3pm)
โจ NAME โจ
okay bestie, so this one is Text::MicroMason::ServerPages โ you'll spot it in your terminal as Text::...erPages(3pm) because the header is out here abbreviating like it's too cool for full names ๐
โ and what it does is give you an Alternate Syntax like ASP/JSP Templates. no cap. that's the whole vibe. ๐ธ
๐ SYNOPSIS ๐
so like, don't just go using this class by itself, okay? you pass its name in to get mixed in:
use Text::MicroMason;
my $mason = Text::MicroMason::Base->new( -ServerPages );
then you use the standard compile and execute methods to parse and evaluate templates, like the good little template gremlin you are:
print $mason->compile( text=>$template )->( @%args );
print $mason->execute( text=>$template, @args );
and Server Pages syntax gives you another way to mix Perl into a text template:
<% 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 %>!
<% } %>
it's giving 2003 web app energy and honestly? we love her. ๐ฆ
๐ DESCRIPTION ๐
This subclass swaps out MicroMason's normal lexer for one that supports a syntax similar to Active Server Pages and Java Server Pages. lexer glow-up, fr fr. โจ
๐ Compatibility with Apache::ASP ๐
Apache::ASP is a full-featured application server toolkit with lots of features, and of all of those, only the templating functionality is emulated here. just the one thing. the template thing. okay? okay.
not me being a drop-in replacement โ this is NOT a drop-in replacement for Apache::ASP, because the implementation is quite different. That said, it should be able to process some existing templates without major changes. ๐ซถ
The following features of EmbPerl syntax are supported:
- Angle-bracket markup tags ๐
The following syntax features are not supported:
- Dynamic XML/XSL processing. ๐
- Web server objects such as
$Session,$Request,$Response, and$Application. ๐ซ - Application events such as
Application_OnStart,Script_OnStart, and othergloga.asafeatures. ๐
๐ง Template Syntax ๐ง
The following elements are recognized by the ServerPages lexer:
<% perl statements %>โ Arbitrary Perl code to be executed at this point in the template. go off, little statement. ๐ฅ<%= perl expression %>โ A Perl expression to be evaluated and included in the output. the output girlie. she gets included. โจ<%& file, arguments %>โ Includes an external template file. ๐<%-- comment --%>โ Documentation or inactive code to be skipped over silently. Can also be used to quickly comment out part of a template. stealth mode activated. ๐คซ<%name> ... </%name>โ Supported block names are:'perl','args','once','init','cleanup', and'doc'. ๐
๐ฎ Private Methods ๐ฎ
lex_token
( $type, $value ) = $mason->lex_token();
Lexer for <% ... %> 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. empty list = she simply could not. ๐
๐ SEE ALSO ๐
- 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 absolute icon of a manpage was brought to you by perl v5.36.0 and dated 2023-08-10 โ slay, periodt, go write 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