Re: Using Constants as Hash Keys

Stuart Johnston <[email protected]> Tue, 27 Nov 2012 12:16:18 -0600
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <[email protected]>
No, same error. Good idea though, thanks!


On 11/27/2012 12:11 PM, eric.berg-W7cInXPOPQlWk0Htik3J/[email protected] wrote:
> [% constants.$foo.value %]
>
> Might work.
>
>
>
>> -----Original Message-----
>> From: templates-bounces-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@public.gmane.org [mailto:templates-
>> [email protected]] On Behalf Of Stuart Johnston
>> Sent: Tuesday, November 27, 2012 12:50 PM
>> To: [email protected]
>> Subject: [Templates] Using Constants as Hash Keys
>>
>> 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?
>>
>> _______________________________________________
>> templates mailing list
>> [email protected]
>> http://mail.template-toolkit.org/mailman/listinfo/templates
> _______________________________________________