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

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.
  • You do an awful lot of hacking. Part of the Jifty philosophy is that we provide (at least) one well integrated way to do everything you need to do. We're big fans of HTML::Mason - it's the templating toolkit that best fits with our model of things - so it's the toolkit that's well integrated into Jifty. We'd love to hear suggestions about how to get TT or other templating engines to support the bits we need.

    I think if you want TT support it will have to come from the Jifty community.

    Why would you use

    • Don't get me wrong. Mason is great. It's fast, it's powerful, it's widely used and therefore widely known. The problem with Mason is that in just about every shop I've worked at, a lot of application logic seems to wind up in the Mason code. This is makes it harder to test and makes components harder to reuse, even if their dislpay properties are generic. Like a subroutine or a method, a template should try to do as little as possible, otherwise you limit your ability to reuse it. Even though Mason doesn't require you to do this, in the real world, this is what I keep seeing happening. This happens because much of the code seems to get developed on the Mason side and the developers slowly work towards the Perl.

      With Template Toolkit, it's inverted. The development clearly starts on the Perl side and works its way out into the template. As a result, it's natural to not put the application logic in the view.

      Now a standard rebuttal to this is "don't blame the tool because the programmer is misusing it" and I have a certain sympathy for that point of view. However, I like tools which allow the "natural" behavior to be the right behavior. This isn't enough of a complaint to keep me away from Jifty, though :)

      • Those are good points and something to think about.

        It wouldn't stop me from using Jifty either since it would be yet another framework I could learn using Perl. I tend to be on the "cleaner separation" side of things and I think TT does well in helping that mentality. Plus I think TT lends itself to other things besides web applications so I can use it more (but that may be wrong since I don't know Mason well enough).

        • Mason can be used for non-web stuff, but I've heard people say that it's tricky. I have no direct experience with this.

          Another nice things about TT is that it's trivial to hande templates to designers. They don't have to learn Perl, just a simple template language. Here's another huge plus, and this alone should sway people:

          [% name = customer.full_name %]

          Is "customer" a hash or an object? Who knows? Who cares? If initially you just pass a hashref and later decide you need to upgrade it to an ob

          • I was reading about StringTemplate [stringtemplate.org] today. It is Java templating system (with C# and Python ports) that enforces the model-view separation and restricts putting code in the template. It takes static input data from the model and a functional template and generates output. The template language does not support assignment, side-effects, or procedural construct. It does allow some smart evaluation with JavaBeans objects or Java collections so it is possible to violate the encapsulation.

            The author point

      • I think the right way to allow that “natural” behaviour is to make it really, really easy to avoid Perl (unlike Mason), rather than making it really, really hard to use Perl (as TT2 prefers).

        The only templating system I’ve ever seen that I really liked is unfortunately Python-only: Kid [lesscode.org]. It’s XML-centric, but it exploits that choice to do its job extraordinarily well: the majority of display logic is described declaratively using namespaced attributes. You need to reach down to Pyth