On Sat, Sep 26, 2009 at 12:15:05AM +0800, 叶孤城 wrote: > 2009/9/26 Bruce Johnson <[email protected]>: > > > > > or just print the html. When executed as a cgi script, the outgoing > > connection from Apache is the script's stdout. Variables substitute just > > fine. > > > > print <<EOF; > > Content-type: text/html\n\n > > <html> > > <link rel="stylesheet" href="./dynamic.css" type="text/css" > > <title>Howdy $username!</title> > > ... > > </html> > > EOF > > > > Works for us. > > > > This way I can do large swaths of straight html code without any issue, and > > no potential complications from added modules. > > > > printing html directly in CGI scripts is maybe convenient for a small > application. > but, its maintainability is worse when the project is increasing. > I may think also using a template is better, that make perl code > separated from front-end codes (html/js/css etc), and make both perl > programmer and designer happy. > I personally prefer Template::Toolkit for CGI and Mason for mod_perl. +1 on TT2 for building sites generally, I'm twiddling on the edges of mod_perl - I really should jump in some time. I use TT2 in command line mode to build a mostly static site with one cgi script which itself uses the TT2 component templates to build the form and process it.
I've basically a banner image, horizontal menu, a content section and some information in a footer. I am able to modify, say, the footer data site wide by editing one file and re-running the sitebuilding script. After testing I can issue the new build and the altered templates for use on the site. More dynamic content will ensue on this site and I will probably want the speed that mod_perl brings. Regards L.
