[Petal] [PATCH] refactored Petal::Hash::Var + todo tests
Jean-Michel Hiver
jhiver at mkdoc.com
Wed May 28 15:48:32 BST 2003
> > 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).
That's cool, I'll try that when I get a minute, unfortunately I don't
have many of them to spare at the moment. I hope waiting for a couple of
weeks is not too bad...
I think auto-vivifying hashes is an acceptable behavior. If it makes
your life easier and no one else's worse then I don't see why we should
not include this.
However this change should not happen in Petal::Hash::VAR...
> 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).
Not really. It's just that I don't want to see Perl code in my
templates, and having a 'perl:' modifier would be like trying not to
smoke with an opened packet of ciggies on the table. Some people would
be disciplined enough not to use 'perl:', I'm sure I wouldn't. :)
> It sounds like the Petal::Expression::Parser that you are talking
> about could be implemented as a modifier a plug-in module.
This sounds like a good idea, until the patch is applied to Petal at
least.
> > 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.
I am not so sure about this. Petal::Hash::VAR is basically called very,
very, VERY often when a template is executed. I'll do some testing
before I release anything to make sure it's not too bad...
Cheers,
--
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver at mkdoc.com - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/
More information about the Petal
mailing list