Template Toolkit Debugging inside of Perl Dancer

The other day someone was asking how to enable Template Toolkit debugging inside of Perl Dancer in the #dancer IRC channel, it seemed like a good time for a write up.

The template engine configuration directive supports passing through various options like start_tag and stop_tag as explained in Dancer::Template::TemplateToolkit POD. And alludes to being able to pass other options.

How

To pass TT options like those found in Template::Constants, there must be a DEBUG section in engines -> template_toolkit, usually found in config.yml.

Example Snippet

Here is an example:

A few notes

  • Remove leading DEBUG_ from TT constants. The option DEBUG_PLUGINS becomes plugins.
  • Multiple options can be separated with a comma. Example:DEBUG: "provider,plugins".
  • Be warned, some of these options can lead to tons of information :)
__END__

Comments

Post a Comment

Popular posts from this blog

BootstrapX clickover

Changing Dancer::Plugin::Ajax's content type