Text::...Handler(3pm)

πŸ“¦
version 2.23 Β· 3 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Text::...Handler β€” the ApacheHandler era πŸ’–

okay bestie, so this page is all about Text::MicroMason::ApacheHandler (3pm), and the whole vibe is: use MicroMason from mod_perl. that's the whole name, that's the whole point. it's giving "templates but make them run inside Apache." ✨


🌸 SYNOPSIS 🌸

first up, you go into your httpd.conf or whatever equivalent Apache configuration file you're living in, and you do this:

PerlModule Text::MicroMason::ApacheHandler

<Files *.mm>
  SetHandler perl-script
  PerlHandler Text::MicroMason::ApacheHandler
</Files>

then over in your document root, or literally any other web-accessible directory, you drop something like:

<% my $visitor = $r->connection->remote_host(); %>
<html>
  Hello there <%= $visitor %>!
  The time is now <%= localtime() %>.
</html>

and that's it. that's the whole flex. πŸ’… the <% ... %> bits are Perl doing its thing, the <%= ... %> bits are Perl doing its thing out loud, and $r is right there waiting for you like the main character it is. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

⚠️ Caution, bestie, listen up: This module is new, experimental, and incomplete. Not intended for production use. Interface subject to change. 🚨

fr fr. do not be putting this in prod and then acting surprised, i'm begging. 😭 if you're interested in this capability though, your feedback would be appreciated β€” genuinely, they want to hear from you. 🫢

πŸŽ€ Configuration πŸŽ€

here are the configuration parameters that are supported, one by one, no skips:

  • MicroMasonSyntax β€” the name of the syntax class that will compile the templates. defaults to HTMLMason. set it like:
PerlSetVar MicroMasonSyntax HTMLMason
  • MicroMasonMixins β€” the list of additional mixin classes to be enabled. stack 'em up:
PerlAddVar MicroMasonMixins Safe
PerlAddVar MicroMasonMixins CatchErrors
  • MicroMasonAttribs β€” allows for any set of attributes to be defined. mixin names prefaced with a dash can also be included. like so:
PerlAddVar MicroMasonAttribs "-AllowGlobals, allow_globals => '$r'"

so yeah, syntax class, mixins, attribs. that's the whole config trio. iconic. 🌈


πŸ’œ SEE ALSO πŸ’œ

  • For an overview of this templating framework, go read Text::MicroMason. πŸ’–
  • This is a mixin class intended for use with Text::MicroMason::Base. 🧚
  • For distribution, installation, support, copyright and license information, head over to Text::MicroMason::Docs::ReadMe. πŸ“š

and that's a wrap, bestie. this page shipped as part of perl v5.36.0, dated 2023-08-10, under the User Contributed Perl Documentation umbrella. slay, goodbye, drink some water. πŸ“βœ¨πŸ‘‘

πŸ“¦ where this page comes from