[Petal] Using '|' in TALES

Lenga, Yair [CIB-FI] yair.lenga at citigroup.com
Sun Aug 13 22:00:05 BST 2006


Hi,

I'm trying to use Petal for a new project that I'm working on.

I tried to use the '|' (alternative value), based on the TALES documentation. I realized this is not listed in the Petal doc, but I tought to give it a try.

When I tried:

<html>
<body>
<p petal:content="my/data | string:nothing" > Someting </p>
</body>
</html>

perl -Mpetal -e 'print new Petal(file=>"file.html", error_on_undef_value => 0)->process();"

I was getting an error (undef value). When I allowed the error (error_on_undef_var = 0), I got empty tag - I was hoping to see "nothing").

I decided to try this without the spaces, same command.

<html>
<body>
<p petal:content="my/data|string:nothing" > Someting </p>
</body>
</html>

What I got was infinite recursion. The program was producing:
Deep recursion on subroutine "Petal::Hash::fetch" at blib/lib/Petal/Hash/Var.pm line 73.
Deep recursion on subroutine "Petal::Hash::Var::process" at blib/lib/Petal/Hash.pm line 188.

and then the program started hitting the disk - asking for more and more memory (the disk activity was probably from swaping). After few seconds, the whoe server could not function.

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.



More information about the Petal mailing list