[Templates] Sticky forms with hierarchical template vars

Perrin Harkins perrin@elem.com
Tue, 8 Jan 2002 10:13:55 -0500

> There's one issue here that crops up in XML::Simple as well -
> when there's just one element, do you represent it as a scalar
> or a list with a single element?  If you have a multi-select
> box and the user only picks one element, the HTTP POST message
> format doesn't distinguish between that and data in a text field.

It's been a while, but I seem to recall that this was okay because you can
loop on the value even if it's a scalar.  There are undoubtedly some tricky
situations where this would trip up though.  Our real version was fancier
because it handled references as well, but that made the code much worse.

If you want to build something using this, I'd suggest using Craig Barrat's
eval-free version, and doing some basic checking on the variable names
(m/^\w+$/ or something).  My version was only for an in-house tool, and it
could easilly be exploited.

Hugh Baker's trick was cool too, but I prefer to do all of my processing
outside of templates.

- Perrin