kage MojoX::JSON::XS;
use Mojo::Base 'Mojolicious::Plugin';
use strict;
use Mojo::Util qw(monkey_patch);
use JSON::XS;
our $VERSION = "0.01";
sub register
{
monkey_patch "Mojo::JSON", encode =
urn encode_json( $_[1] ); };
monkey_patch "Mojo::JSON", decode => sub { return decode_json( $_[1] ); };
monkey_patch "Mojo::JSON", j => sub { if(ref $_[0]) { return encode_json( $_[0] );
else { return decode_json( $_[0] ); }
};
}
1;
=encoding utf8
=head1 NAME
MojoX::JSON::XS - A JSON::XS backend replacement for Mojo::JSON
=head1 SYNOPSIS
sub startup
kage MojoX::JSON::XS;
use Mojo::Base 'Mojolicious::Plugin';
use strict;
use Mojo::Util qw(monkey_patch);
use JSON::XS;
our $VERSION = "0.01";
sub register
{
monkey_patch "Mojo::JSON", encode =
urn encode_json( $_[1] ); };
monkey_patch "Mojo::JSON", decode => sub { return decode_json( $_[1] ); };
monkey_patch "Mojo::JSON", j => sub { if(ref $_[0]) { return encode_json( $_[0] );
else { return decode_json( $_[0] ); }
};
}
1;
=encoding utf8
=head1 NAME
MojoX::JSON::XS - A JSON::XS backend replacement for Mojo::JSON
=head1 SYNOPSIS
sub startup