in reply to Creating reports with HTML::Template and CGI::Application

When dealing with HTML::Template, Template toolkit, or other such templating modules, you must separate what you're doing into two (mostly) unrelated things - the data structure you generate and the template that accepts that data structure.

I would recommend doing the following:

  1. Examine what you're doing and figure out what items/groups of items are similar. Those are candidates for looping.
  2. Figure out what items/groups of items can change between invocations of your page. (Things like date, username, colors, etc.)
  3. Create a data structure that encapsulates how the programmer thinks of the output.
  4. Then, and only then, create a template that will take that data structure and display it appropriately.

If you follow that method, you're aren't tied to a given templating module. :-)

Now, C::A has nothing to do with H::T. Yeah, it uses it by default (and most C::A users also use H::T), but they are solving two completely unrelated problems. (I use H::T to templatize Apache config files that never see the WWW.) C::A is meant to simplify how pages in your application relate to each other. It sounds like you're understanding that (for the most part), but you're having issues with H::T and how to build with/for it.

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

  • Comment on Re: Creating reports with HTML::Template and CGI::Application