HTML::CallJS - Pass server side data to JavaScript safety.
use HTML::CallJS; call_js('foo', {x => 1}); # => <script class="call_js" type="text/javascript">foo({"x":1})</script>
Pass server side data to JavaScript safety.
use Text::Xslate; use HTML::CallJS; my $tx = Text::Xslate->new( html_builder_module => [ 'HTML::CallJS' => [qw(call_js)] ] ); print $tx->render_string( '<: call_js("foo", {x=>$x}) :>', { x => 5963 }, ), "\n"; # => <script class="call_js" type="text/javascript">foo({"x":5963})</script>
You can use HTML::CallJS with Text::Xslate.
Copyright (C) tokuhirom.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This method is introduced by kazuhooku. http://d.hatena.ne.jp/kazuhooku/20131106/1383690938
tokuhirom <tokuhirom@gmail.com>
To install HTML::CallJS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::CallJS
CPAN shell
perl -MCPAN -e shell install HTML::CallJS
For more information on module installation, please visit the detailed CPAN module installation guide.