Thanks Maverick, it is becoming more clear to me now ;). To prove the point, here's an excerpt from an app I'm now building:

File: main.cgi
#!/usr/local/bin/perl -w use strict; use HTML::Template; ################################### ## includes ################################### use XCGI; require "config.pl"; ################################### ## MAIN ################################### my $cgi = new XCGI; # my version of CGI (with a few subs added/redefin +ed). print $cgi->header(); my $template = new HTML::Template(filename => "$CONFIG::template_root/ +main.tmpl", die_on_bad_params => 0); $template->param( select_box_datasource => $cgi->select_list(-name=>'s_dns', -values=>[keys(%CONFIG::ds_info)], -labels=>{sh=>\%CONFIG::ds_info, so +urce_key=>'info'}, -default=>['webdb'], -size=>1), ); print $template->output();

File: templates/main.tmpl
<html> <title>Automation Tool</title> <body> <form> <table border=1 > <tr> <td> Select Datasource: <TMPL_VAR NAME="select_box_datasource"> <br> </td> </table> </form> </body> </html>
Note that select_box_datasource variable will hold a piece of custom built html similar to this:
<SELECT NAME="s_dns" SIZE=1> <OPTION VALUE="foo">Production <OPTION SELECTED VALUE="foobar">Development <OPTION VALUE="bar">Development 1 </SELECT>

the select_list() subroutine is implemented (overwritten) inside XCGI module which serves as my (custom) extension to standard CGI. Although, CGI has a similar subroutine, it didn't fit the needs of my application (as seen from the code...).


"There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith

In reply to Re: Q / A and HTML::Template techniques... by vladb
in thread Q / A and HTML::Template techniques... by maverick

Title:
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, details, 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, summary, 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.