[Petal] Using '|' in TALES

Jonathan petal-list at 2xlp.com
Mon Aug 14 01:16:58 BST 2006


On Aug 13, 2006, at 5:00 PM, Lenga, Yair [CIB-FI] wrote:

> Few questions:
> - Is the '|' suppose to work with TAL ? what is the correct syntax.
> - Any chance of fixing the bug ? My pages are designed by a  
> designer - My goal with Petal is to limit his ability to impact  
> server performance.

Sadly, Petal isn't strictly TAL.  It's almost... the guys who make it  
have a good portion of TAL in there, and usually fix stuff they  
overlook when they realize it.  But there There are a few things in  
TAL that aren't in Petal, and vice versa.

If you don't hear anything within the next few days from them  
regarding the bug, there are some options before you give up:

	a- you can try some of the other TAL implementations in Perl.  Last  
I checked there were 2 others on CPAN.  Neither did the code caching  
or anything like you see in Petal (one was admittedly anti-caching).   
But they all were much more compliant with the spec.

	b- alter your code slightly:
		"my/data | string:nothing" => "my/F_data 'nothing'"

		instead of data being a string in the hash you pass to petal, its a  
sub reference, that does the lookup manually, and handles the return  
value

The beauty of TAL is that you can just have your designer handle the  
templates to the TAL spec, and then use any implementation you want.   
I have  the same TAL templates running on Petal Template::TAL, python  
and phptal.


// Jonathan Vanasco




More information about the Petal mailing list