Open cxw42 opened 4 years ago
I have similar issue here with Text::Xslate (via Perl and Mojolicious).
I can do this:
my $arr=[1,2,3];
but I can not do this :
$arr[1] = 12;
I can do this:
my $y = {a=>1,b=>2};
But I can not do this:
$y['c'] = 3;
or even this:
$y['a'] = 3;
All is forbidden!
After hearing so much about Text::Xslate I thought I give it a try. And after converting all my templates to this system, BAM! it hits me Forbidden, Forbidden, Forbidden.
Can anyone shed any light on this? I am in the middle of a project and just found out my car has triangular wheels.
Assignment within templates is forbidden in Kolon and discouraged by the docs for TTerse. Why is that? The only explanation I have found is a comment that it was for the sake of simplicity.
Context: I am looking for a sandboxed DSL in which people can implement business logic. The target users of the DSL are not Perl programmers, so
Safe
is not an option, and neither are many of the other template engines (e.g.,Text::MicroTemplate
, referenced in the linked comment). TTerse looks like it might do the job very nicely! However, I would like to understand whether assignment is at risk of disappearing in a future release before committing to TTerse.Thank you in advance for your insights!