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

πŸ’– NAME πŸ’–

CGI::Application::Plugin::AnyTemplate::Driver::HTMLTemplateExpr β€” bestie, this is the HTML::Template::Expr driver for AnyTemplate. It's a User Contributed Perl Documentation page (that's the 3pm section, iykyk πŸŽ€).


🌸 DESCRIPTION 🌸

Okay so. This is a driver for CGI::Application::Plugin::AnyTemplate, and what it does is hand over the implementation details specific to rendering templates via the HTML::Template::Expr templating system. It's giving backstage crew energy πŸ’…

All the "AnyTemplate" drivers are designed to be used the exact same way. For the general usage instructions, go read the docs of CGI::Application::Plugin::AnyTemplate. No notes, it's all there 🫢


πŸ¦‹ EMBEDDED COMPONENT SYNTAX (HTML::Template::Expr) πŸ¦‹

✨ Syntax ✨

The HTML::Template::Expr syntax for embedding components is literally this:

<TMPL_VAR EXPR="CGIAPP_embed('some_run_mode', param1, param2, 'literal string3')">

And you can override that with these configuration variables:

embed_tag_name       # default 'CGIAPP_embed'

So say you set this value in your configuration file:

embed_tag_name       '__ACME_render'

Then your embedded component tag is gonna look like:

<TMPL_VAR EXPR="__ACME_render('some_run_mode')">
⚠️ Heads up bestie: the value of embed_tag_name must consist of numbers, letters and underscores (_), and must not begin with a number. That's the vibe check, don't fail it πŸ’€

πŸŽ€ CONFIGURATION πŸŽ€

The CGI::Application::Plugin::AnyTemplate::Driver::HTMLTemplateExpr driver accepts these config parameters, no cap:

  • embed_tag_name β€” the name of the tag used for embedding components. Defaults to CGIAPP_embed. Cute, right? ✨
  • 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. Periodt. πŸ’…
  • associate_query β€” okay so, this feature is now deprecated and will be removed in a future release. Not me warning you 🫠

If this config parameter is true, then CGI::Application::Plugin::AnyTemplate::Driver::HTMLTemplateExpr will copy all of the webapp's query params into the template using HTML::Template::Expr's associate mechanism:

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

By default associate_query is false.

And lowkey important: if you provide an associate config parameter of your own, that will disable the associate_query functionality. They can't both be main character, sorry 😭

All other configuration parameters are passed on unchanged to HTML::Template::Expr. Slay.

🌈 required_modules 🌈

The required_modules function returns the modules required for this driver to operate. In this case: HTML::Template::Expr. That's the whole roster, iconic πŸ‘‘


πŸ‘‘ DRIVER METHODS πŸ‘‘

  • initialize β€” initializes the HTMLTemplateExpr driver. See the docs for CGI::Application::Plugin::AnyTemplate::Base for details. 🧚
  • render_template β€” fills the HTML::Template::Expr object with $self->param, and returns the output (as a string reference). See the docs for CGI::Application::Plugin::AnyTemplate::Base for details. Literally obsessed with how simple that is πŸ’–

πŸ”₯ 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::HTMLTemplatePluggable
  • 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

πŸ’œ AUTHOR πŸ’œ

Michael Graham, "<mgraham@cpan.org>" β€” thank you 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. Fr fr, that's the whole license, go wild (responsibly) 🌸


Okay bestie, that's the whole page! This one came from perl v5.30.3, dated 2020-10-26, and the man page it lives in is CGI::A...ateExpr(3pm). Go forth and render those templates, you absolute icon πŸ’…βœ¨

πŸ“¦ where this page comes from