Templa...::Mojo(3pm)

πŸ’– Template::Provider::Mojo πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation collection, and it's literally the manual for Template::Provider::Mojo, which lives in the 3pm section (that's the perl module manual section, iykyk). it's giving "let Mojolicious do the template heavy lifting" and honestly? iconic. πŸ’…


✨ NAME ✨

Template::Provider::Mojo β€” use Mojolicious to provide templates πŸ¦‹


🌸 SYNOPSIS 🌸

my $app = Mojolicious->new;
$provider = Template::Provider::Mojo->new({MOJO_RENDERER => $app->renderer});

($template, $error) = $provider->fetch($name);

no cap, that's the whole vibe right there 🫢


πŸ’œ DESCRIPTION πŸ’œ

so Template::Provider::Mojo is a subclass of Template::Provider β€” a glow-up, if you will β€” and it uses a Mojolicious::Renderer instance to resolve template names. main character energy fr fr. πŸ’…

what that actually means for you:

  • "paths" in Mojolicious::Renderer get searched for file-based templates πŸ“‚
  • "classes" in Mojolicious::Renderer get searched for DATA templates πŸ—‚οΈ
  • the "ENCODING" configuration setting gets initialized to "encoding" in Mojolicious::Renderer if it's unset β€” so if you didn't set it, it gets set for you, slay ✨

πŸŽ€ METHODS πŸŽ€

Template::Provider::Mojo inherits all the methods from Template::Provider, and then implements these new ones. it's giving "family recipes plus my own secret sauce" πŸ˜­πŸ’–

🧚 fetch

returns a compiled template for the name you specify. for all the usage details, go check out "fetch($name)" in Template::Provider. literally just peek over there, it's all there πŸ”₯

πŸ¦‹ load

loads a template without parsing or compiling it. this one is used by the INSERT directive β€” so it's the lowkey workhorse behind the scenes, no parsing, no compiling, just vibes πŸ’€βœ¨


πŸ’€ BUGS πŸ’€

found something broken? report any issues on the public bugtracker. not me asking you to file a bug report but also yes me asking you to file a bug report πŸ™ˆπŸ«Ά


πŸ‘‘ AUTHOR πŸ‘‘

Dan Book <dbook@cpan.org> β€” legend behaviour, periodt πŸ’…


this software is Copyright (c) 2015 by Dan Book.

it's free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

so yes bestie, you can use it, it's GPL compatible, go off πŸŽ€


⭐ SEE ALSO ⭐

  • Template
  • Mojolicious::Renderer
  • Mojolicious::Plugin::TemplateToolkit

and that's the whole page, bestie!! this was documented for perl v5.36.0, dated 2023-02-24, and the original header/footer called it Templa...::Mojo(3pm) because even manpage titles get truncated sometimes πŸ˜­πŸ’– mwah, go build something cute with it 🫢✨