Alt-Template-Plugin-JSON-Moo

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

                url  => 'https://github.com/tehmoth/Alt-Template-Plugin-JSON-Moo.git',
            },
        },
    },

    'INSTALLDIRS' => 'site',
    'EXE_FILES'   => [],
    'PL_FILES'    => {}
);

unless ( eval { require JSON::XS } ) {
warn <<WARN
JSON::XS is reccomended, you should probably install it for better performance.
WARN
}

lib/Template/Plugin/JSON.pm  view on Meta::CPAN

	isa => Types::Standard::HashRef,
	is  => "ro",
	default => sub { {} },
);

sub BUILDARGS {
	my ( $class, $c, @args ) = @_;


	if ( @args == 1 and not ref $args[0] ) {
		warn "Single argument form is deprecated, this module always uses JSON/JSON::XS now";
	}

	my $args = ref $args[0] ? $args[0] : {};

	return { %$args, context => $c, json_args => $args };
}


sub _build_json_converter {
	my $self = shift;

lib/Template/Plugin/JSON.pm  view on Meta::CPAN


	[% USE JSON %]
	[% data = JSON.json_decode(json) %]
	[% data.thing %]

=head1 DESCRIPTION

This plugin provides a C<.json> vmethod to all value types when loaded. You
can also decode a json string back to a data structure.

It will load the L<JSON> module (you probably want L<JSON::XS> installed for
automatic speed ups).

Any options on the USE line are passed through to the JSON object, much like L<JSON/to_json>.

=head1 SEE ALSO

L<JSON>, L<Template::Plugin>

=head1 VERSION CONTROL



( run in 0.505 second using v1.01-cache-2.11-cpan-4d50c553e7e )