[Dancer-users] config.yml options not visible to Dancer::Template::HtmlTemplate

GJ gj at freeshell.org
Wed Mar 21 06:36:42 CET 2012


On Tue, Mar 20, 2012 at 03:29:08PM +0000, David Precious wrote:
> 
> Sorry for the slow reply.
> 
> On Sun, 18 Mar 2012 18:23:59 +0000
> GJ <gj at freeshell.org> wrote:
>  
> > While I can set my needed options for HTML::Template in config.yml
> > per the documentation/guidance of the list, it never reaches
> > Dancer::Template::HtmlTemplate.  The issue is here, in
> > HtmlTemplate.pm, in in the render method :
> > 
> > ----
> >     my $ht = HTML::Template->new(
> >         filename => $template,
> >         die_on_bad_params => 0, # Required, as we pass through other
> > params too
> >         %{$self->config}
> >     );
> >     $ht->param($tokens);
> >     return $ht->output;
> > ----
> > 
> > The problem is that $self->config is empty here.  I'm using version
> > 0.06.
> 
> What does your config.yml look like?
> 

----
appname: "My::App" 

# The default layout to use for your application (located in
# views/layouts/main.tt)
layout: "main"

# when the charset is set to UTF-8 Dancer will handle for you
# all the magic of encoding and decoding. You should not care
# about unicode within your app when this setting is set (recommended).
charset: "UTF-8"

#template: "simple"
template: "html_template"
engines:
 HtmlTemplate:
   loop_context_vars: '1'
   global_vars: '1'

session: "cookie"
session_cookie_key: "xxxx"

plugins:
               Database:
                   driver: 'mysql'
                   database: 'xxxx'
                   host: 'localhost'
                   username: 'xxxx'
                   password: 'xxxx'

----

I noticed that some of the other template plugins actually access
$self->config in init() by the way.

Thanks
GJ


More information about the Dancer-users mailing list