[Petal] Neato Tricks That Aren't Documented Anywhere

William McKee william at knowmad.com
Thu Jan 13 23:03:35 GMT 2005


On Thu, Jan 13, 2005 at 12:13:55PM -0600, Warren Smith wrote:
> After reading the Petal source, I found that if you use petal:attributes
> to assign an attribute an undefined value, the attribute gets omitted,
> thusly:

That's a very nifty trick. Too bad we don't have a place to put these
kinds of tips.


> Secondly, I developed a decode: modifier that works similar to Oracle's
> decode statement. It should be making it into the next release of
> Petal::Utils.


It's been in Petal::Utils for the past several months. I've used it
a few times and find it much nicer than using the if/then/else modifier
(with apologies to Steve :).


> So, making even/odd rows of a table different classes is relatively
> easy.

Another nice usage example. I hadn't considered this possibility.


> Finally, correct me if I'm wrong, but with stock Petal, you cannot
> include a file with a variable filename. So Jean-Michel helped me create
> an include: modifier that allows you to use variable names as include
> files.

Too bad you weren't reading the list last month. Josh was looking for
this capability[1]. Hopefully he's still subscribed to see a solution
for his situation. Chris suggested using METAL but we never heard back
from Josh.


> Yeah, yeah. I'm going to get a lot of "you didn't know that?" looks, but
> I didn't (wasn't documented) and thought somebody else may be having the
> same problem.

Not from me. So, include: is a stock modifier that isn't documented? If
so, we ought to document it. If not, send it over and I'll include it in
the next release of Petal::Utils (unless Steve has objections to adding
a potentially dangerous modifier).


William

[1] http://lists.webarch.co.uk/pipermail/petal/2004-December/000957.html

-- 
Knowmad Services Inc.
http://www.knowmad.com


More information about the Petal mailing list