|laziness, impatience, and hubris|
My fellow and esteemed Monks, I come to thee penitent, in search of wisdom and guidance.
Background: While I have tried to become a better Monk and user of perl in general, I have harbored a dark, embarassing secret sin in my coding, which I must now confess: Only recently have I begun to take my first faltering steps in learning to use a CPAN-available templating system. To my shame, I have generally embedded the HTML of many of my CGI scripts internally, either with print statements or, recently, with HERE documents, and only once did I venture so far into the darkness as to write my own simplistic attempt at a templating system. Once I learned about the available templating systems, and was able to get one of them installed on the system on which most of those CGIs run, it was my goal to someday go back and recode those still in use to use templates, so as to ease their maintenence.
"Someday" has now become now, as I have been asked to modify the "look and feel" of the scripts in order to make them more closely match that of the rest of the systems in use. While most of them involve minor changes that can wait, a "due date" has been set on about a dozen of the worst offenders (in terms of radically different appearance). These dozen or so happen to be some of the oldest of the CGIs, so it seemed logical to attempt to migrate them to templates for the future. I have now run into a problem, which I seek your guidance on.
Problem: Several of the scripts display data in an almost condensed form in tables, which I do not know how to replicate using HTML::Template. A simplified example-I may have returned a dozen or so values to display, and display them four to a line, so I may be returned (1, 3, 4, 6, 7, 8, 10, 12, 13, 14, 15, 19, 23, for instance) and need to display them as:
My question is, do I have to do something in the code to do this, or is there a way in HTML::Template that I can have it only display the number of items per line I need (it would be a fixed number for that page, if that makes it easier)? Would embedded loops or included templates do this, or would they be more complicated than necessary?
I am truly outside of my knowledge range at the moment as I try to learn to do this, and to learn to be a better coder. Your attention and wisdom are greatly appreciated.
In reply to A question regarding HTML::Template, tables, and loops by atcroft