You are looking for a template engine, such as HTML :: Mason (or Mason), so that it “compiles” the source components into perl code, but instead of perl code they will “compile” the components into JavaScript code and after running / executing them using Javascript: : V8 module perl.
Motivation: finding a solution for a secure template language that can edit users without compromising server security . JavaScript is a full-featured language, so its use is probably better / faster than some “mini-languages" such as TT or similar. Best for me would be a Mason extension (rewriting) to compile in Joose / JavaScript instead of Moose / Perl .;)
And yes, you want to do this with perl using Javascript :: V8, because this method is possible by having the very available power of perl through Javascript :: V8 $ context-> bind_function.
Questions:
- Does anyone know something like? (nothing found in CPAN) ...
EDIT: in Mason you can write for example
% #perl version % my(@list) = qw(Jane John Doe); <ul> % foreach my $item (@list) { <li><% uc($item) %></li> % } </ul>
it would be nice to be able to write above in JS, for example:
% //javascript version % var list = ["Jane", "John", "Doe"]; <ul> % for(var i in list) { <li><% perl_uc($list[i]) %></li> % } </ul>
The above source must be "compiled" in JavaScript (Joose) and executed using Javascript :: V8. (as in Mason - the source is compiled into a perl / Moose object and executed with perl) ...
As you can see, for(var i in list) written in pure JS, not in a "mini-language" ...
perl v8 mason
kobame
source share