EJS::Template::Util - Utility for EJS::Template
Usage:
my $original_ref = \'some text'; my $modified_ref = clean_text_ref($original_ref, $encode_utf8, $sanitize_utf8, $force_untaint); # where the last three arguments are boolean values # to indicate whether each conversion is required.
Depending on JavaScript engines, the text value passed from Perl to JavaScript needs to be cleaned up, especially related to the UTF8 flag and the taint mode.
It takes a reference to the text as the first argument, and returns a reference to the modified text, of if no conversion is necessary, the original reference is returned.
$encode_utf8
Indicates the text needs to be a utf8-encoded string, where the utf8 flag has to be turned off.
$sanitize_utf8
Indicates the text cannot contain any invalid utf8 characters. The conversion is done by applying Encode::decode_utf8() and then Encode::encode_utf8().
Encode::decode_utf8()
Encode::encode_utf8()
$force_untaint
Indicates tainted strings cannot be passed to the JavaScript engine. This flag effectively disables the taint flag, trusting the JavaScript code to be safe.
EJS::Template
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.