Group
Extension

Matches 1

Template-Plugin-JSON-Escape ( N/NA/NANTO/Template-Plugin-JSON-Escape-0.02.tar.gz, NANTO, 2011; MetaCPAN )
Template-Plugin-JSON-Escape/lib/Template/Plugin/JSON/Escape.pm ( view source; MetaCPAN )
Plugin::JSON::Escape;
use strict;
use warnings;

use base qw/Template::Plugin/;
use JSON ();

our $VERSION = 0.02;

sub new {
    my ($class, $context, $args) = @_;
    my $self = bless { json => unde
 $self->json_encode( @_ ) };
    $context->define_vmethod( $_ => json => $encode ) for qw/hash list scalar/;
    $context->define_filter( json => \&json_filter );

    return $self;
}

sub json {
    
   return $self->{json} if $self->{json};

    my $json = JSON->new->allow_nonref;
    my $args = $self->{args};
    for ( keys %$args ) {
        $json->$_( $args->{ $_ } ) if $json->can( $_ );
    }

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