Altering TT's INCLUDE_PATH in Dancer with Custom View

Altering Template Toolkit's INCLUDE_PATH in Dancer

This just came up on Dancer's mailing list and I've been sitting on this code (and post) for a few months since the project I was working on didn't need it.

Basically Dancer's Template Toolkit view requires you completely alter it or use the default setting. This is pain if you just want to add to it but not have to manage all the changes.

I created a new TT view class, to get inside the TT init and add to the INCLUDE_PATH instead of replace it. The code was a bit involved and I extended it a bit by adding a customization flag in each environment (if needed).

On to the code

Here is the code and config that i used to do this

Disclaimer

I don't recall all the other issues that i ran into while doing this. It was over 6 months ago but post questions if you have them

__END__

Comments

  1. Replies
    1. Web Development Course is relevant because the discussion focuses on customizing the template layer of a web application. Extending the view class provides a cleaner way to manage reusable templates and environment-specific configuration without unnecessarily duplicating the framework's existing behavior.

      Delete
    2. The use of a customization flag for each environment is also a practical idea when different deployments require different template locations. This kind of configurable template management fits well with a Frontend Training perspective, where maintaining organized and reusable view resources can make web applications easier to manage as they evolve.

      Delete

Post a Comment

Popular posts from this blog

2 ways to get SQLite to put dates into columns

BootstrapX clickover

Please don't create tests like this in Perl