[Dancer-users] Feeding options to Dancer::Template::HtmlTemplate

GJ gj at freeshell.org
Mon Feb 20 00:03:51 CET 2012


On Thu, Feb 16, 2012 at 11:06:31AM +0000, David Precious wrote:
> On Wed, 15 Feb 2012 19:46:36 +0000
> GJ <gj at freeshell.org> wrote:
> 
> > Hi all,
> > 
> > I am migrating a vanilla CGI application that relies on
> > HTML::Template to dancer, and so of course I will use the
> > Dancer::Template::HtmlTemplate library for now.  
> > 
> > Where do I feed my usual HTML::Template options like
> > loop_context_vars, global_vars, and so on to the plugin? The source
> > code indicates that there is a %{$self->config} that is passed on to
> > HTML::Template, but its not clear to me when to fill this out.  
> 
> That should come from the template engine's config in config.yml - so
> you'd want something like:
> 
>   engines:
>     HtmlTemplate:
>       loop_context_vars: ...
>       global_var: ...
> 
> 
> Whilst that's how it works for all the template engines, it should
> probably be documented better - I'll try to find a moment to update the
> docs to show an example.

Thanks for this information! Then for hypothetical savings, to turn off or on
particular settings for a given route, I'd have to do something like this I
suppose:

config->{engines}->{HtmlTemplate}->{expensive_option} = 0

et cetera?

Thanks,
GJ


More information about the Dancer-users mailing list