[Petal] compiled expression (again)

Jean-Michel Hiver jhiver at mkdoc.com
Thu Jun 19 15:33:45 BST 2003


> That leaves 3 ways
> 
> * $res .= define($hash->{"user"});
> * $res .= do {my $v = $hash->{"user"}; defined($v) ? $v : ""};
> * $res .= $hash->{"user"}; with warnings turned off
> 
> I think turning off warnings is easiest and fastest and seems harmless to me 
> as long as it's configurable and they are turned on by the test suite. The 
> warnings would only be turned off inside the template code, 

I have one major problem with that: warnings which would be triggered by
falty code in the methods that you're calling from the templates would
be hidden as well. And calling methods from templates is something I do
a lot.

This is the reason for which I prefer the template approach compared
with tools like XSL, you can pass objects to your template and use
powerful, object-embedded bits of code, which you can't do when doing
purely transforms.

So I would be more than keen to sacrifice a bit of speed to get the
important debugging info I need.

So maybe:

> * $res .= do {my $v = $hash->{"user"}; defined($v) ? $v : ""};

Would be the way to go?
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