---
name: "Template::Provider::Mojo"
section: "3pm"
platform: "linux"
package: "libmojolicious-plugin-templatetoolkit-perl"
version: "0.006-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Template::Provider::Mojo"
---

# Template::Provider::Mojo(3pm)

Use Mojolicious to provide templates

## 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);
```

## DESCRIPTION

Template::Provider::Mojo is a Template::Provider subclass that uses a Mojolicious::Renderer instance to resolve template names. This means that "paths" in Mojolicious::Renderer will be searched for file-based templates, and "classes" in Mojolicious::Renderer will be searched for DATA templates. The `"ENCODING"` configuration setting will be initialized to "encoding" in Mojolicious::Renderer if unset.

## METHODS

Template::Provider::Mojo inherits all methods from Template::Provider and implements the following new ones.

### fetch

Returns a compiled template for the name specified. See "fetch($name)" in Template::Provider for usage details.

### load

Loads a template without parsing or compiling it. This is used by the INSERT directive.

## BUGS

Report any issues on the public bugtracker.

## AUTHOR

Dan Book \<dbook@cpan.org\>

## COPYRIGHT AND LICENSE

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

This is free software, licensed under:

```
  The Artistic License 2.0 (GPL Compatible)
```

## SEE ALSO

Template, Mojolicious::Renderer, Mojolicious::Plugin::TemplateToolkit
