[Petal] [PATCH] refactored Petal::Hash::Var + todo tests

William McKee william at knowmad.com
Wed May 28 09:29:06 BST 2003


On Wed, May 28, 2003 at 11:54:04AM +0100, Steve Purkis wrote:
> The patch introduces a parser object to Petal::Hash::Var.  IMHO, this 
> would do better off as something like Petal::Expression::Parser - then 
> other objects would be able to use it (which is what I was originally 
> planning on doing to auto-vivify things in Petal::Hash).

Have you looked at the TALES specs for type prefixes? It defines a
prefix called `python:`. Jean-Michel has opted not to implement a
similar prefix for perl to prevent punching holes in the security of the
templating system (at least I think that's his reason). It sounds like
the Petal::Expression::Parser that you are talking about could be
implemented as a modifier a plug-in module.

Personally, I follow the philosophy of templates as limited
mini-languages. Thus I haven't needed the ability to run perl code or
auto-vivify hashes inside of my templates. However, if it makes Petal a
better tool, I'm generally all for it.


> Note that performance may drop slightly as a result of this patch: what 
> used to be one static method has now become many different instance 
> methods.  I doubt this will be a big issue though.

That depends on the benefits that are gained. Not being familiar with
the Petal::Hash::Var module, I can't offer an answer to that question.
Hopefully Jean-Michel will have some input on this thread soon. In the
meantime, have you done any benchmarking to see how big the speed
difference is?

Thanks,
William

-- 
Knowmad Services Inc.
http://www.knowmad.com


More information about the Petal mailing list