package Template::JavaScript; BEGIN { $Template::JavaScript::AUTHORITY = 'cpan:AVAR'; } BEGIN { $Template::JavaScript::VERSION = '0.01'; } # vim: ft=perl ts=4 sw=4 et: use v5.010.1; use Any::Moose; # For compiling our output use JavaScript::V8; # For generating our output use Template; # Utility functions use JavaScript::Value::Escape; =head1 NAME Template::JavaScript - A templating engine using the L module =head1 SYNOPSIS use Test::More qw( no_plan ); use Template::JavaScript; my $tj = Template::JavaScript->new(); $tj->output( \my $out ); $tj->tmpl_string( <<'' ); before % for( var i = 3; i ; i-- ){ this is a loop % } after $tj->run; is( $out, <<'', 'can run simple JS code (loops)' ); before this is a loop this is a loop this is a loop after =head1 DESCRIPTION This is a very simple template to JavaScript compiler. We compile either templates passed in as strings or as a file with L