Re: Using Constants as Hash Keys
Darren Chamberlain <[email protected]> Thu, 29 Nov 2012 14:21:42 -0500
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Message-ID | <CAAKoLZkb8myX6vWvQkJugdsuF9nQthujtec6j=z30xgLfxz2Tg@mail.gmail.com> |
On Thu, Nov 29, 2012 at 12:11 PM, Stuart Johnston <[email protected]> wrote: > It is a hashref. I just trimmed it down to the minimum that causes the error. To be more clear: > > [% x = { constants.foo => "value" } %] > > Or: > > [% function({ constants.foo => "value" }) %] > > It works fine as an arrayref so currently I am just converting it back to a hash on the perl side. The LHS of a hash is always treated as a string in TT, since that's almost always what you want. The ugly ${} syntax you're forced to use is because you're trying to perform the less-common operation. -- Darren Chamberlain <[email protected]>