I don't have a lot of expierence with web development, but sometimes it's the best means to and end. I'm currently retrofitting an existing web based tool to use HTML::Template and by the end of the week I'm going to start working on converting it to use CGI::Application. I'm also working on a project that's in the planning phase where I'll be using HTML::Template and CGI::Application.

My question has to do with the strcutre of the application. I'm pretty anal about things being "clean", and I always feel like my web apps get out of hand. I have to do some redesign around how the content is printed to work with CGI::Application because I create and print different sections at different points in the app. For instance, the top title/header area is generated in one location and the left side panel is generated in another. Now this won't work with CGI::Application because I need to return the entire content from the method call. Now this lead me to this question..

How do people normally generate the different sections of content? It seems to me that I now have two options. I can either "templatize" the entire page (top, left and the main content) for each different "mode", or I can have each "mode" call fuctions that return strings that contain the top and left and then tie up the footer and closing div/table/html tags.

Neither way seems all that "clean" to me and leaves me feeling that I'm missing a better, "cleaner" way to make the logic flow and be more readable.

I'd appreciate any feedback. Also, if this would more approptriatly fit in Meditations, feel free to move it. I wasn't sure where it would be better.


In reply to HTML::Template, CGI:Application and design methodologies by rchiav

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.