On 11/29/2012 4:24 AM, Dave Howorth wrote:
Stuart Johnston wrote:
Trying to use a constant as a hash key gives this error: "unexpected
token (.)".

Here is what I am trying to do:

[% { constants.foo => "value" } %]

This works but is a bit ugly:

[% { ${constants.foo} => "value" } %]

Any other suggestions?

I don't understand what you are trying to do. What are the braces for?

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.


_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to