CGI::A...ggable(3pm)

πŸ’– NAME πŸ’–

CGI::Application::Plugin::AnyTemplate::Driver::HTMLTemplatePluggable β€” bestie, it's the HTML::Template::Pluggable driver for AnyTemplate. That's it, that's the girl. πŸŽ€

(and yes, the page header says CGI::A...ggable(3pm), because even perl's manpage formatter gets tired and abbreviates. iconic behavior honestly.)


✨ SYNOPSIS ✨

  # Load Pluggable and your plugins before using this driver.
  use HTML::Template::Pluggable;
  use HTML::Template::Plugin::Dot;

okay so read that comment, fr fr. Load Pluggable and your plugins BEFORE you touch this driver. Order matters, no cap. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

This is a driver for CGI::Application::Plugin::AnyTemplate, and its whole job is holding the implementation details that are specific to rendering templates through the HTML::Template::Pluggable templating system. Very niche, very demure. ✨

The way that all the AnyTemplate drivers work is literally the same, bestie β€” they're designed to be used identically. So for the general how-do-I-even-use-this instructions, go read the docs of CGI::Application::Plugin::AnyTemplate. This page is just the Pluggable-specific tea. πŸ“


🌸 EMBEDDED COMPONENT SYNTAX (HTML::Template::Pluggable) 🌸

πŸŽ€ Syntax πŸŽ€

The HTML::Template::Pluggable syntax for embedding components is, and I need you to look at this carefully:

    <TMPL_VAR NAME="cgiapp.embed('some_run_mode',
                                 param1,
                                 param2,
                                 'literal string3')"
    >

Look at her go. πŸ‘‘

This can be overridden by the following configuration variables:

    embed_tag_name       # default 'cgiapp'

So for instance, by setting the following value in your configuration file:

    embed_tag_name       '__acme'

Then the embedded component tag will look like:

    <TMPL_VAR NAME="__acme.embed('some_run_mode')">

⚠️ and here's the rules bit: the value of embed_tag_name must consist of numbers, letters and underscores (_), and must not begin with a number. Don't try it. It's giving invalid tag name energy and it will not slay. πŸ’€


πŸ’… CONFIGURATION πŸ’…

The HTMLTemplatePluggable driver accepts the following config parameters, bestie, take notes:

  • embed_tag_name β€” the name of the tag used for embedding components. Defaults to cgiapp.
  • template_extension β€” if auto_add_template_extension is true, then CGI::Application::Plugin::AnyTemplate will append the value of template_extension to filename. By default the template_extension is .html. πŸŽ€
  • associate_query β€” 🚨 this feature is now deprecated and will be removed in a future release. 🚨

If this config parameter is true, then HTMLTemplatePluggable will copy all of the webapp's query params into the template using HTML::Template's associate mechanism:

    my $driver = HTML::Template::Pluggable->new(
        associate => $self->query,
    );

By default associate_query is false.

And heads up: if you provide an associate config parameter of your own, that will disable the associate_query functionality. Yours wins, periodt.

All other configuration parameters are passed on unchanged to HTML::Template. Unchanged. Not touched. Straight through. πŸ’«

🌈 required_modules 🌈

The required_modules function returns the modules required for this driver to operate. In this case: HTML::Template. Short list, we love a low-maintenance queen. πŸ‘‘


πŸ‘‘ DRIVER METHODS πŸ‘‘

  • initialize β€” initializes the HTMLTemplate driver. See the docs for CGI::Application::Plugin::AnyTemplate::Base for details. ✨
  • render_template β€” fills the HTML::Template::Pluggable object with $self->param, replacing any magic *embed* tags with the content generated by the appropriate runmodes.

Returns the output of the filled template as a string reference. (a string reference, bestie, not a plain string β€” don't get got. 🫢)

See the docs for CGI::Application::Plugin::AnyTemplate::Base for details.


🧚 SEE ALSO 🧚

  • CGI::Application::Plugin::AnyTemplate
  • CGI::Application::Plugin::AnyTemplate::Base
  • CGI::Application::Plugin::AnyTemplate::ComponentHandler
  • CGI::Application::Plugin::AnyTemplate::Driver::HTMLTemplate
  • CGI::Application::Plugin::AnyTemplate::Driver::HTMLTemplateExpr
  • CGI::Application::Plugin::AnyTemplate::Driver::TemplateToolkit
  • CGI::Application::Plugin::AnyTemplate::Driver::Petal
  • CGI::Application
  • Template::Toolkit
  • HTML::Template
  • HTML::Template::Pluggable
  • HTML::Template::Plugin::Dot
  • Petal
  • Exporter::Renaming
  • CGI::Application::Plugin::TT

like... that's a whole friend group right there. go say hi. 🌈


πŸ’œ AUTHOR πŸ’œ

Michael Graham, "<mgraham@cpan.org>" β€” thank you for your service, king. 🫑


Copyright 2005 Michael Graham, All Rights Reserved.

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

legally binding but make it cute. same terms as Perl itself, bestie. πŸ’–

and that's the whole page! πŸŽ€ this gorgeous thing comes to you from perl v5.30.3, dated 2020-10-26, filed under User Contributed Perl Documentation, and the header/footer both just call it CGI::A...ggable(3pm) because it was too long for the margin. she's abbreviating, she's iconic, she ate. bye bestie!! πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from