rchiav has asked for the wisdom of the Perl Monks concerning the following question:

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.