Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (10)
    As of 2018-06-21 22:19 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (120 votes). Check out past polls.