Group
Extension

Matches 1

Text-MiniTmpl ( P/PO/POWERMAN/Text-MiniTmpl-v2.0.1.tar.gz, POWERMAN, 2018; MetaCPAN )
Text-MiniTmpl/lib/Text/MiniTmpl.pm ( view source; MetaCPAN )
ings;
use strict;
use utf8;
use Carp;

our $VERSION = 'v2.0.1';

use Export::Attrs;
use JSON::XS qw( encode_json );
use URI::Escape qw();
use HTML::Entities qw();

use constant UNSAFE_HTML=> '&"\'<>' 
xport {
    my ($s) = @_;
    if ($POST eq UTF8POST) {
        $s = JSON::XS->new->encode($s);
    } else {
        $s = encode_json($s);
    }
    $s =~ s{</script}{<\\/script}xmsg;
    return $s;
}
$complex );

Encode $complex data structure (HASHREF, ARRAYREF, etc. - any data type
supported by JSON::XS) for inserting into JavaScript code (usually inside
HTML templates).

Example:

    <script>

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.