Module...n::TT2(3pm)

πŸ“¦
version 0.125 Β· 2 versions
  • 0.125 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.125 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Module::Starter::Plugin::TT2 β€” the manual page, but make it make sense πŸ’–

okay bestie, so this is the Module::Starter::Plugin::TT2 page, and it lives in section 3pm of the User Contributed Perl Documentation. That's the whole vibe. Sit down, grab a strawberry πŸ“, and let's get into it.


✨ NAME ✨

Module::Starter::Plugin::TT2 β€” it's the TT2 templates plug for Module::Starter::Template. That's it, that's the name, iconic.


🌸 VERSION 🌸

version 0.125


πŸ¦‹ SYNOPSIS πŸ¦‹

use Module::Starter qw(
  Module::Starter::Simple
  Module::Starter::Plugin::Template
  Module::Starter::Plugin::TT2
    ...
);

Module::Starter->create_distro( ... );

that's literally all you need to see. so clean.


πŸ’… DESCRIPTION πŸ’…

so here's the tea: this Module::Starter plugin is intended to be loaded after Module::Starter::Plugin::Template. like, order matters, bestie, don't come for me.

it implements the renderer and render methods β€” the ones the Template plugin requires, no cap β€” and it implements them using Template Toolkit. so TT2 does the heavy lifting and honestly? she ate. πŸ”₯


πŸŽ€ EXAMPLES πŸŽ€

this module's distribution ships with a directory, templates/dir, and a file, templates/inline, and they're full of stock templates for using with the InlineStore and DirStore plugins. your starter pack, fr fr. 🌈

on Debian systems, those files get installed in /usr/share/doc/libmodule-starter-plugin-tt2-perl/examples

and the module itself? she's carrying default templates for the ModuleStore plugin, tucked right there in her data section. self-sufficient queen. πŸ‘‘


🧚 USAGE 🧚

this module is meant to be used with the template stores in the SimpleStore distribution β€” though lowkey you could absolutely write your own template store, nobody's stopping you, do your thing. πŸ’œ

if all you want is the built-in templates, your config file (~/.module-starter/config) could have lines like this:

author: Lord Poncemby
email: ponce@peerage.eng
plugins: Module::Starter::Simple Module::Starter::Plugin::Template
 Module::Starter::Plugin::ModuleStore Module::Starter::Plugin::TT2
template_module: Module::Starter::Plugin::TT2

(and yes β€” the plugins line is one line, the wrap is just the page being dramatic.)

what this does is tell Module::Starter to go look for the templates in the data section of Module::Starter::Plugin::TT2. which… isn't very interesting, ngl 😭 because you'll end up getting the exact same effect as if you'd just used Module::Starter with no plugins at all. it's giving "did all that for nothing".

to override this behavior, you'd tell Module::Starter to look somewhere else. three routes, pick your fighter:

  • change the template_module setting
  • change the MODULE_TEMPLATE_MODULE environment variable
  • or use a totally different template store altogether (q.v., SimpleStore or other plugins)

and if you need to send parameters to the Template constructor, put them in the template_parms parameter of the create_distro method. ⚠️ it must be a hash reference. not optional, not negotiable, hash reference or bust. 🫢


πŸ‘‘ METHODS πŸ‘‘

renderer

as implemented, this method just creates a brand-new Template Toolkit engine and stores it in the Module::Starter object. that's the whole job. she's efficient. ⭐

render( $template, \%options )

this method passes the given template contents and options along to the TT2 renderer, and returns the resulting document. in one side, out the other. slay. ✨


πŸ’– AUTHOR πŸ’–

Ricardo SIGNES, "<rjbs@cpan.org>"


Copyright 2004-2006 Ricardo SIGNES, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay and that's the page, bestie πŸ¦‹ shoutout to perl v5.36.0 and the date 2022-12-06 for stamping this whole thing, and to Module...n::TT2(3pm) β€” yes the header is literally cut off like that, the terminal did her best, we love her anyway. go build a distro. periodt. πŸ’…πŸŽ€

πŸ“¦ where this page comes from