Hi, I have previously developed a system for workflow colloboration for my previous employer, wherein I tried to achieve the same goal of separting the GUI (HTML content) from the business process logic. I did not use any modules like HTML::Template but however I just cached all the html files with place holders (templates) into a hash. The names of the templates and their filenames including path are associated/driven by a parameter file. The names serve as the keys for the hash and the html content as value. The html content is populated with place holders like #customer_name# etc. The only problem is where a table with multiple rows of data to be populated typically with some values coming from a database. In these cases the html code defining the row itself is made a template and the main template file holds a place holder of this template name. While using mod_perl, I have loaded the hash in the startup.pl code so that there exists only one copy of this hash for all instances of webserver processes. To simplify remembering the place holders, you may like to use the same names of the fields/columns in the database table, but however these are validated for spurious code before loading into the hash. This scheme has worked well for me and the response time will be very good as there is no need to read any html files for each query, as all the templates are in memory. Except for the place holder tags the templates are free from any embedded code. The server side logic is clean as it is devoid of any content generating code (html related stuff) and the logic is easy to comprehend. This scheme has worked well for me and you may like to try the same. Hope that helps. Thanks babumovva

In reply to Re: Need help separating logic from display by babumovva
in thread Need help separating logic from display by jeyroz

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.