Flutterby™! : Perl & web development

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

Perl & web development

2006-02-22 19:14:46.49923+00 by Dan Lyke 7 comments

Okay, John and whomever else: I probably don't need a full web development framework, but what's the right templating system to use for Perl[Wiki] development? I've got something that'll need to be done fast, I'm proficient in Perl[Wiki], but it's not a personal project, so I'll want it written in a system that will leave a good impression on future users.

[ related topics: John S Jacobs-Anderson Perl Open Source ]

comments in ascending chronological order (reverse):

#Comment Re: [Entry #8689] Perl & web development made: 2006-02-22 19:46:03.121964+00 by: Unknown, from NNTP

Dan Lyke <danlyke@flutterby.com> writes:

>    Okay, John and whomever else: I probably don't need a full web
>    development framework, but what's the right templating system to use
>    for Perl [Wiki] development? 

TIMTOWTDI, but I'm a fan of Template Toolkit. You'll probably also see people recommending HTML::Template and Mason -- I think those are the leading contenders at this point.

#Comment Re: made: 2006-02-22 19:48:22.523256+00 by: kennyg [edit history]

I'd recommend Catalyst for a web framework, and if you're looking for a templating module, Template Toolkit.

#Comment Re: made: 2006-02-22 19:52:29.092613+00 by: Dan Lyke

So given Monday's recommendation of Catalyst, and two votes for Template Toolkit, I guess I know what I need to be reading...

#Comment Re: made: 2006-02-22 19:55:32.039871+00 by: Mark A. Hershberger

Not HTML::Mason -- at least with Template Toolkit (TT) you have an option of keeping the Perl out of your template. And HTML::Template almost insists that you keep your code and template separate.

I love TT, but a friend swears by H::T. If you use TT, it has caching and other options you can use to make it go faster.

Also, not sure this is of interest, but Jemplate is like TT, but client side. I've not used it, but I understand it gets the browser to render the template and just passes in the necessary info. Tim Bray wrote something about pushing data to the client and letting it render it and how that would help performance.

#Comment Re: made: 2006-02-23 04:52:48.965949+00 by: dws

The first thing I reach for is HTML::Template.

#Comment Re: made: 2006-02-23 17:47:01.585933+00 by: other_todd [edit history]

I'm using Template Toolkit at present for my two freelance clients because it is very good for fast small work and it plays well with everybody. You can install TT in ten minutes and become proficient with it in a day; its online documentation (http://www.template-toolkit.org/docs/plain/Manual/index.html) is good. I will probably change over to using it for page templating on my personal site the next time I get a couple of free days to do it.

But if I were dealing with a larger project with a LOT of integrated Perl, I would probably make the investment in Mason. I was using Mason a lot just before I left MIT. The problem with Mason is that 1) it really only plays well with Perl and 2) it's a big messy install, at least as compared to TT. It also has a higher learning curve. Because it uses a Struts-like action/handler system, it means a lot more adaptation if you have existing hard HTML you want to change over to the system.

The good thing about Mason, if you don't mind committing to Perl, is that integrating Perl - even very large chunks of Perl - into your "presentation layer" is seamless - you can just prefix those lines and intersperse them with your HTML, Mason knows what to do.

TT is limited in what sort of calculations you can actually do in the template (basic calculations, assignments, and iterate-through-data-lists only) and its syntax gets physically messy very fast. I also hear TT does not scale up well on performance, but I'm using it on a site which has about thirty templates, some reasonably complex and backed by a lot of cross-table SQL on the Perl side, and the site is not notably slow. (We'll see how it does under load; the site isn't open to the public yet, heh.)

I do not personally care for HTML::Template, but I know others like it.

Edited to add one thing which doesn't apply to Dan: If you are on an ISP setup where you do not have direct/easy access to the Apache configuration or the normal Perl library paths, this makes it very difficult for you to install Mason, and considerably more difficult for you to install H::T, but it does not seem to have affected TT (which you can install in your local cgi-bin if you so choose).

#Comment Re: [Entry #8689] Re: made: 2006-02-23 20:26:02.515389+00 by: Unknown, from NNTP

other_todd <prefersanonymity_37@flutterby.com> writes:

>    TT is limited in what sort of calculations you can actually do in the
>    template (basic calculations, assignments, and
>    iterate-through-data-lists only) 

You can embed Perl in TT templates -- it's not recommended, and it wrecks the presentation/representation barrier all to hell and gone, but it's possible.