Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

CromeDome (4395)

CromeDome
  (email not shown publicly)
http://www.cromedome.net/
AOL IM: TheOneCromeDome (Add Buddy, Send Message)

Hello, I'm MrCromeDome from Perl Monks. [perlmonks.org] See my account there or my home page for more info.

Journal of CromeDome (4395)

Friday July 11, 2003
09:06 PM

Templating Modules

[ #13403 ]

In this post on Perl Monks, I think I probably came off sounding a bit more stupid than I probably am (though, I admit I probably should have stated the question better).

To recap briefly, I need to generate a somewhat complex form in Perl. Some really good suggestions for this were presented, and at present, I am evaluating several of them. Further discussion with tilly convinced me that I have a lot more to learn about templating systems.

I am a one man web shop and my place of employment. I do all the design and programming for our few web products. Because our products are deployed for multiple accounts, I needed an easy way of changing the look and feel of each site for each client. And I found and fell in love with HTML::Template. While it helped me to overcome that barrier, I have fallen into some other bad habits that I need to break.

HTML is not a strong suit of mine. Programming is (though as far as things go for me, I still consider myself a Perl novice). And I can do things in Perl (such as producing forms with CGI.pm) that I don't understand all that well in HTML. And so I end up with an ugly, interesting mix of code and pseudo-content that is not all-together well-separated. The little separation I've had though has been sufficient - flexibility in site layout.

Now I find myself working with a web designer on a new project who is completely new to Perl. For the first time I will be forced to give up all my bad habits, but I don't know how :P It's my impression that HTML::Template will work nicely - for what little I've looked at other templating systems, HTML::Template most closely seems to resemble pure HTML, which is all my designer will be capable of doing.

And so I fork() a new learning process. Should anybody reading have some insight to share, it is appreciated.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Personally -- and keeping in mind my low level of experience with other templating systems at this point, I'm going on hearsay and documentation -- I'd say HTML::Template isn't a terrible way to start. It's the first templating module I ever touched, and it's simple enough that you can pick it up in short order and be functional with it pretty quick.

    Now, my understanding is that Text::Template provides more flexibility in the type of things you can generate, and Template Toolkit...does some other things

    --

    ------------------------------
    You are what you think.
    • I'm not sure if more power is what I'm looking for, just a way to shed my bad habits. How have you used HTML::Template in the past? Have you been able to completely give up HTML generation with the methods provided by CGI.pm?

      I spent some time after writing the parent entry looking at Template Toolkit. Some very sweet things you can do :) But I still don't see how that is well-suited for not-so-technical web designers. Maybe it's just the couple I've been accustomed to using, but I'm not sure they coul
      • What I know about TT I could fit on the head of a pin, pretty much just that it exists.

        Mason's another creature -- that I know some stuff about, but it's pretty heavy-duty.

        HTML::Template allowed me to get rid of (roughly) 90% of the HTML I was generating. That's a speed increase, plus I suspect I could get a little more picky about what I was importing from CGI and reduce memory overhead. Further, I'd be willing to say that I could have probably just used HTML::Template for HTML and used CGI for form

        --

        ------------------------------
        You are what you think.
  • I'm not entirely clear what you're asking or what your bad habits are, but if you're in the habit of using CGI.pm for 'sticky' forms then you ought to take a look at HTML::FillInForm. You can use it to post-process the output from HTML::Template and plug form values back into the HTML - it's magic!
    • The bad habits I keep referring to are using HTML::Template to create a header and footer for each page, then pretty much using CGI.pm to fill in the rest of the page content (tables, forms, etc.).

      I guess maybe what I was looking for was any insight people would like to share as far as their experiences with templating, tips or pitfalls, etc., especially with HTML::Template. I've spent most of my programming time since yesterday looking into what others have done with HTML::Template, and I think that I ma