The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<html><head><title>Dancer2::Template::TextTemplate::FakeEngine</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >

<style type="text/css">
 <!--/*--><![CDATA[/*><!--*/
BODY {
  background: white;
  color: black;
  font-family: arial,sans-serif;
  margin: 0;
  padding: 1ex;
}

A:link, A:visited {
  background: transparent;
  color: #006699;
}

A[href="#POD_ERRORS"] {
  background: transparent;
  color: #FF0000;
}

DIV {
  border-width: 0;
}

DT {
  margin-top: 1em;
  margin-left: 1em;
}

.pod { margin-right: 20ex; }

.pod PRE     {
  background: #eeeeee;
  border: 1px solid #888888;
  color: black;
  padding: 1em;
  white-space: pre;
}

.pod H1      {
  background: transparent;
  color: #006699;
  font-size: large;
}

.pod H1 A { text-decoration: none; }
.pod H2 A { text-decoration: none; }
.pod H3 A { text-decoration: none; }
.pod H4 A { text-decoration: none; }

.pod H2      {
  background: transparent;
  color: #006699;
  font-size: medium;
}

.pod H3      {
  background: transparent;
  color: #006699;
  font-size: medium;
  font-style: italic;
}

.pod H4      {
  background: transparent;
  color: #006699;
  font-size: medium;
  font-weight: normal;
}

.pod IMG     {
  vertical-align: top;
}

.pod .toc A  {
  text-decoration: none;
}

.pod .toc LI {
  line-height: 1.2em;
  list-style-type: none;
}

  /*]]>*/-->
</style>


</head>
<body class='pod'>
<!--
  generated by Pod::Simple::HTML v3.28,
  using Pod::Simple::PullParser v3.28,
  under Perl v5.018002 at Thu Apr 17 17:05:01 2014 GMT.

 If you want to change this HTML document, you probably shouldn't do that
   by changing it directly.  Instead, see about changing the calling options
   to Pod::Simple::HTML, and/or subclassing Pod::Simple::HTML,
   then reconverting this document from the Pod source.
   When in doubt, email the author of Pod::Simple::HTML for advice.
   See 'perldoc Pod::Simple::HTML' for more info.

-->

<!-- start doc -->
<a name='___top' class='dummyTopAnchor' ></a>

<div class='indexgroup'>
<ul   class='indexList indexList1'>
  <li class='indexItem indexItem1'><a href='#NAME'>NAME</a>
  <li class='indexItem indexItem1'><a href='#VERSION'>VERSION</a>
  <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a>
  <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a>
  <li class='indexItem indexItem1'><a href='#ATTRIBUTES'>ATTRIBUTES</a>
  <ul   class='indexList indexList2'>
    <li class='indexItem indexItem2'><a href='#caching'>caching</a>
    <li class='indexItem indexItem2'><a href='#expires'>expires</a>
    <li class='indexItem indexItem2'><a href='#delimiters'>delimiters</a>
    <li class='indexItem indexItem2'><a href='#cache_stringrefs'>cache_stringrefs</a>
    <li class='indexItem indexItem2'><a href='#prepend'>prepend</a>
    <li class='indexItem indexItem2'><a href='#safe%2C_safe_opcodes%2C_safe_disposable'>safe, safe_opcodes, safe_disposable</a>
  </ul>
  <li class='indexItem indexItem1'><a href='#METHODS'>METHODS</a>
  <ul   class='indexList indexList2'>
    <li class='indexItem indexItem2'><a href='#process(_%24template%2C_%5C%25tokens_)'>process( $template, \%tokens )</a>
  </ul>
  <li class='indexItem indexItem1'><a href='#AUTHOR'>AUTHOR</a>
  <li class='indexItem indexItem1'><a href='#COPYRIGHT_AND_LICENSE'>COPYRIGHT AND LICENSE</a>
</ul>
</div>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>

<p>Dancer2::Template::TextTemplate::FakeEngine - Fake Template::Toolkit-like,
persistent engine around Text::Template.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="VERSION"
>VERSION</a></h1>

<p>version 1.003</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>With <a href="http://search.cpan.org/perldoc?Template%3A%3AToolkit" class="podlinkpod"
>Template::Toolkit</a>-like engines,
you instantiate <i>one</i> engine to process <i>multiple</i> templates.
With <a href="http://search.cpan.org/perldoc?Text%3A%3ATemplate" class="podlinkpod"
>Text::Template</a>,
you instantiate <i>one</i> engine to process <i>one</i> template.
This class is a simple wrapper around Text::Template to simplify its use as a template engine in <a href="http://search.cpan.org/perldoc?Dancer2" class="podlinkpod"
>Dancer2</a>.
It basically just manage Text::Template instances (and their expiration) through <a href="http://search.cpan.org/perldoc?CHI" class="podlinkpod"
>CHI</a>.</p>

<p>You can give this engine templates as filenames or string references:</p>

<ul>
<li>with a filename,
the corresponding file will be read by <a href="http://search.cpan.org/perldoc?Text%3A%3ATemplate" class="podlinkpod"
>Text::Template</a>;</li>

<li>a string ref will be dereferenced and its content used as the template content itself.</li>
</ul>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="ATTRIBUTES"
>ATTRIBUTES</a></h1>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="caching"
>caching</a></h2>

<p>Whether a cache should be used for storing Text::Template instances,
or not.</p>

<p>Defaults to <code>1</code> (caching enabled).</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="expires"
>expires</a></h2>

<p>How longer (in seconds) the a Text::Template instance will stay in the cache.
After this duration,
when the corresponding template is requested again,
a new Text::Template instance will be created (and cached).</p>

<p>Defaults to <code>3600</code> (one hour).
Obviously irrelevant if <code>caching</code> is set to <code>0</code>!</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="delimiters"
>delimiters</a></h2>

<p>An arrayref of (two) delimiters,
as defined in <a href="http://search.cpan.org/perldoc?Text%3A%3ATemplate%23new" class="podlinkpod"
>Text::Template#new</a>.</p>

<p>Defaults to <code>[ &#39;{&#39;,
&#39;}&#39; ]</code>.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="cache_stringrefs"
>cache_stringrefs</a></h2>

<p>If this attribute and <code>caching</code> are true (which is the default),
string-ref-templates will always be cached forever (since they cannot become <i>invalid</i>,
contrary to template files that can be changed on disc when FakeEngine doesn&#39;t watch).</p>

<p>However,
you may want to disable this behavior for string-ref-templates if you use a lot of such templates only once (they would fill your cache).
By setting <code>cache_stringrefs</code> to <code>0</code>,
you tell FakeEngine not to cache (at all) your string-ref-templates.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="prepend"
>prepend</a></h2>

<p>Contains the string of Perl code added at the top of each evaluated template.
See <a href="https://metacpan.org/pod/Text::Template#PREPEND-feature-and-using-strict-in-templates" class="podlinkurl"
>PREPEND in Text::Template</a>.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="safe,_safe_opcodes,_safe_disposable"
>safe,
safe_opcodes,
safe_disposable</a></h2>

<p>These attributes are directly linked to the eponymous options in <a href="http://search.cpan.org/perldoc?Dancer2%3A%3ATemplate%3A%3ATextTemplate" class="podlinkpod"
>Dancer2::Template::TextTemplate</a>.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="METHODS"
>METHODS</a></h1>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="process(_$template,_\%tokens_)"
>process( $template,
\%tokens )</a></h2>

<p>Computes the <code>$template</code> according to specified <code>\%tokens</code>.</p>

<p>If <code>$template</code> is a string,
it is taken as a filename for the template file (if this file does not exist,
the method <code>croak</code>s).
If <code>$template</code> is a scalar reference,
it is taken as a reference to a string that contains the template.
In any other case,
this method will <code>croak</code> furiously.</p>

<p>Note that,
if <code>caching</code> is true,
(dereferenced) string references will be cached too.</p>

<p>This methods simply gets a Text::Template instance (either from cache or by instantiating it) and calls <code>Text::Template::fill_in( HASH =&#62; \%tokens )</code> on it,
returning the result.</p>

<p>If an error occurs in Text::Template,
this method returns <code>undef</code>,
sets <code>Dancer2::Template::TextTemplate::FakeEngine::ERROR</code> to the value of <code>Text::Template::ERROR</code> and does not cache anything.</p>

<p>This is our cache.
We should gather CHI-related options from config.yml to support other caching methods like Memcached.
That sounds overkill to me,
but an open interface is always better than a predefined one!</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="AUTHOR"
>AUTHOR</a></h1>

<p>Thibaut Le Page &#60;thilp@cpan.org&#62;</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="COPYRIGHT_AND_LICENSE"
>COPYRIGHT AND LICENSE</a></h1>

<p>This software is copyright (c) 2014 by Thibaut Le Page.</p>

<p>This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.</p>

<!-- end doc -->

</body></html>