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.
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 quite well that I don't understand yet...and Mason is, well, industrial strength templating and componenting and...lots of stuff I don't quite get yet.
Eh, all I'm saying is that HTML::Template is fine, but that if you need more somehow, you may want to look elsewhere instead of trying to extend it. Plenty of other stuff's been put together that has more power, it seems.
Re:HTML::Template
CromeDome on 2003-07-12T12:16:45
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 could handle putting templates together with it. Re:HTML::Template
chaoticset on 2003-07-13T17:38:32
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 handling, even though I didn't.
I wasn't concerned about all that -- I was polling a database of maybe 20 fake news stories and producing a front page of the 5 most recent (just a little Slashdot knockoff for a final project in my Perl class.) The neatest thing I figured out was that I could select stylesheets according to program logic instead of hardcoding it into the page template. (I didn't know a lot about CSS at the time, though, or I'd have added a handy-dandy personalized styling feature.)
Re:Sticky forms
CromeDome on 2003-07-13T15:21:20
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 may finally be on the right track. HTML::FillInForm sounds like it may help solve most of the rest of my problems, and I'm going to go check it out. Thanks for the recommendation!