EJS::Template::JSAdapter - JavaScript engine adapter for EJS::Template
Instantiates a JavaScript engine adapter object.
my $engine = EJS::Template::JSAdapter->create();
If no argument is passed, an engine is selected from the available ones.
An explicit engine can also be specified. E.g.
my $engine = EJS::Template::JSAdapter->create('JE');
Creates an adapter object.
This method should be overridden, and a property named 'context' is expected to be set up.
package Some::Extended::JSAdapter; use base 'EJS::Template::JSAdapter'; sub new { my ($class) = @_; my $context = Some::Underlying::JavaScript::Context->new(); return bless {context => $context}, $class; }
Retrieves the underlying context object.
Binds variable mapping to JavaScript objects.
This method should be overridden in a way that it can be invoked like this:
$engine->bind({ varname1 => $object1, funcname2 => sub {...}, ... });
Evaluates a JavaScript code.
$engine->eval('print("ok\n")');
To install EJS::Template, copy and paste the appropriate command in to your terminal.
cpanm
cpanm EJS::Template
CPAN shell
perl -MCPAN -e shell install EJS::Template
For more information on module installation, please visit the detailed CPAN module installation guide.