On Wed, Apr 02, 2003 at 03:13:38PM -0500, Till, Jeff wrote: > So is there anything that a template can do for me that a perl sub will not? > Thanks
Functionally? No. Practically? Well, by separating logic and presentation, code becomes easier to maintain and easier to debug. [Note that TT can be horribly abused to break this. TT doesn't precent mingling, just makes it easy to separate] Heck, by using TT templates, we've even managed to get HTML reuse in addition to code reuse. Really, we're not looking at anything perl can't do...but TT provides two things: 1) A convenient structure for it all. 2) A friendlier interface for non-programmers. Frankly, I'm not a big fan of a lot of the examples in the documentation. They do a lot of things I would thwak anyone here for trying (DBI in templates is a No-no! Ditto for CGI.) They do a lot more math and contortions than I'd recommend. (Of course, I haven't offered alternative docs, so take my criticism in the spirit intended). But try converting some of your subs to TT templates as an example. Think if you're doing a presentation task, or a programming task, and put the proper code bits in each. (You'll still have perl code, it's just setting and determining variables. The TT code will display this in HTML). Realize how you can change the look of the page without touching perl code, and vice versa. See that if you have a nice generic blurb of TT template, you can call it from multiple places. Hope that helps. -- SwiftOne [EMAIL PROTECTED] _______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
