Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Take a step back from your application and your CGI::Application work. As you said, with CGI::Application you must return the entire content from the method call. When you generate a webpage with your existing app, your browser cannot render or display the page until it has the entire page, so it's essentially the same thing. You could just wrap your entire bit of cgi code in a sub and then return the entire page, you'd get what you want but lose any benefits.

As for how I prefer to generate content, I say follow what you call templatizing the entire page. Try to break up your different sections into their own functions, then call them to populate your template. Hmmm, looks like I answered by saying, "both."

I wasn't really exposed to this methodology until I was involved with a largish Java j2ee web project (at which point I asked, "why don't we do this in perl," after which I discovered cgi::application and another framework and realized we did) and even more so later with a portal project. Every bit of content in the portal came from it's own object/function and the portal is just there to put a nice skin on them (using a template.)

Once you start writing this way, it becomes much easier. Code reuse and all that blah blah blah. Take the chatterbox client to the right. It doesn't care about tags, it just dumps what it's got and the site takes care of it. You could wrap the chatterbox in a table cell like it is now or wrap it with html body tags and make it a page by itself.


In reply to Re: HTML::Template, CGI:Application and design methodologies by elwarren
in thread HTML::Template, CGI:Application and design methodologies by rchiav

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2021-12-03 20:36 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (30 votes). Check out past polls.