> -----Original Message----- > From: Till, Jeff [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 02, 2003 3:14 PM > To: '[EMAIL PROTECTED]' > Subject: RE: [Templates] Why use Template Toolkit? > > > So is there anything that a template can do for me that a > perl sub will not? > Thanks > ~jeff
Nope, except maybe organize things a bit differently. I think for a lot of us the benefit is exactly the opposite, when set up properly, there are a lot of things a template CAN'T do. This is important when you are trying to keep your presentation looking like HTML and your code looking like perl. With templates, the coders do all the heavy lifting and the site designers do all the pretty stuff, without even having the ability to call on things not granted to them by the coders. That way I have code that doesn't have HTML and headers and such scattered all through it and they have .HTM files that aren't burdened with scads of embedded snippets of spaghetti-code perl. I get code reuse by having a master base of code that calls all kinds of templates and template/HTML use by having generic templates that handle errors from anywhere in the code. If you want tho, you can use Apache::Template and turn on all the goodies and use TT2 in much the same way you'd use ASP or PHP, as "perl/cgi inside-out" where the code is quoted and the html text is in the clear. I've personally done sites with both methodologies, and with other toolkits, and I have to say that if I was building something from scratch for a large company I'd do it the same way Vivek says below; move the code to mod_perl handlers and keep your templates simple and free of non-presentation code. --mark mills > -----Original Message----- > From: Vivek Khera [mailto:[EMAIL PROTECTED] > Well, the way we use it, all the presentation is done in TT and the > hard lifting done in perl. This totally separates these two > functions. If you're happy having your program create the HTML, then > you're all set the way you have it now. If you prefer to do your HTML > using other tools, and then just call perl to get data, using TT is > ideal for that. Especially as a mod_perl handler... _______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
