> The main bad thing about this is that when we spec out a project, each
> "view" on the application we spec out as 2 days instead of 1 day of work
in
> the equivalent Perl because coding the taglibs gets to be a pain.

Template Toolkit is a good way to do something similar in Perl.  The obvious
way to use it is in the JSP "Model 2" style, with a mod_perl handler doing
some work and then passing data on to a template for display.  However, you
can also use more of a "callback" style, like this:

[% USE prod = product( id => 27 ) %]
[% prod.name %] for only [% prod.price %]
[% FOREACH img = prod.images %]
<IMG SRC=[% img.src %] WIDTH=[% img.width %] HEIGHT=[% img.height %]>
[% END %]

This code will call a method on a perl class to instantiate a new product
object and make it available to the rest of the template.  This is very
different from the taglib API, but it sounds like the resulting templates
are pretty similar to the way Extropia uses JSP.

I was part of the original discussion group for JSP, and when the first
public draft was finalized I was rather disappointed that we couldn't get
everyone to agree on a standard taglib for basic conditionals and iterators
with JavaBeans.  These are fairly easy to code using the taglib API, but
they just seem so obvious that they should have been included in the spec
rather than having every vendor make their own slight variation.

- Perrin

Reply via email to