Template::Flute::Filters::JsonVar - JSON to Javascript variable filter
Takes a Perl structure or a JSON string and returns Javascript which parses the JSON string with Jquery and assigns it to the variable json.
json
Example:
{username => 'shopper@nitesi.biz', city => 'Vienna'};
results in the following JavaScript:
var json = $.parseJSON('{"post":"Vienna","username":"shopper@nitesi.biz"}');
The init method allows you to set the following options:
Value is either jquery or eval.
jquery
eval
Filters the given Perl structure to a JSON string.
To install Template::Flute, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Flute
CPAN shell
perl -MCPAN -e shell install Template::Flute
For more information on module installation, please visit the detailed CPAN module installation guide.