[Petal] Re: Using Test::More

Jean-Michel Hiver jhiver at mkdoc.com
Wed Apr 9 10:38:17 BST 2003


>>I probably didn't know very much about writing test suites when I 
>>started Petal. One thing that worries me is that I don't think that 
>>Test::More is part of the standard Perl distribution. Is it?
> 
> It comes with Perl 5.8.0 but not 5.6.1. It's used by a lot of modules so I'd 
> guess most people have it.

Well, if it's standard with 5.8 I think it's fine.


>>That being said, I know that Test::More is immensely better than what 
>>I'm doing at the moment..
> 
> 
> I've changed a few more tests to use Test::More. The changes are all very 
> mechanical, in fact a sufficiently long 1-liner would probably do most of the 
> work if I was feeling adventurous!
> 
> Patch attached.

Cool :-)


> My new codegenerator passes all except 17 tests. Most of those are things I 
> just didn't implement yet.

What is the difference between your CodeGenerator and the one I wrote? 
I'm curious :)


> I don't really know enough about the innards of Petal but that scheme sounds 
> ok. I did have another question about local/global stuff in general. What 
> happens when you set a variable globally that has already been set locally? 
> What does Zope's TAL do in that case?

I think it should always fetch the local variable first. 'local' is 
misleading for us Perl freaks, I think we should be really read it as 'my'.


> Finally, in atrributes and defines you seem to be using \; when you want to 
> include a ; in the value. The TAL spec says ;s should be escaped as ;; rather 
> than \;. Maybe you could have both for compatibiliy,

I think ;; is a mistake. There is a well known mechanism to escape meta 
characters which is used by almost everything out there which consists 
of backlashing them, which is why I consciously broke this TALES rule.

Why re-invent the wheel?

Come to think of it, there are quite a few differences between TALES and 
PETALES (which is entirely defined in the Petal::Hash::Var module). With 
  Petal expression syntax, you can.

* Pass parameters to methods that you call, which I find extremely handy
* NOT use the pipe (|) symbol (but this should really be implemented)
* Use \ to escape any character
* Use the '.' symbol in place of '/'.

The more I think about all this and the more I think that PETALES should 
really be the same as TALES. BUT:

* I don't like the ';;' rule.
* I would like to remove the '.' as an alias of the '/', but it would 
break backwards compatibility, so we need to have a one-liner option to 
keep the old module somewhere so that it's still possible to run 
templates with the old behavior.
* I still need to be able to pass parameters to methods from the template.

Cheers,
Jean-Michel.



More information about the Petal mailing list