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

GJ gj at freeshell.org
Sun Mar 18 19:23:59 CET 2012


Hi all,

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.

Also, I don't necessarily want die_on_bad_params hard coded that way.

Besides that, what I really miss is the ability to do this sort of thing:

----
if (condition) {
    set a certain param for the template
} else {
    set some other param
}
----

I can't do this because the module doesn't inherit the param method from
HTML::Template.  Can't Dancer be wangled into setting template tokens in
multiple places for a given route, or must it happen all at once?

Side note -- whitespace is apparently syntactically significant in YAML.  Of
what possible benefit is that? 

Clues or opinions welcome.

Thanks,
GJ


More information about the Dancer-users mailing list