Group
Extension

Matches 2

JSON5 ( K/KA/KARUPA/JSON5-0.01.tar.gz, KARUPA, 2016; MetaCPAN )
JSON5/lib/JSON5.pm ( view source; MetaCPAN )
e JSON5;
use 5.008001;
use strict;
use warnings;

our $VERSION = "0.01";

use Exporter 'import';
our @EXPORT = qw/decode_json5/;

use JSON::PP;
use JSON5::Parser;

my $JSON5; # cache

sub decode_json5
 { ($JSON5 ||= JSON5->new->utf8)->decode(@_) }

sub new {
    my $class = shift;
    return bless {
        parser => JSON5::Parser->new,
    } => $class;
}

sub true;
sub false;
*true  = \&JSON::PP::
true;
*false = \&JSON::PP::false;

# define accessors
BEGIN {
    for my $attr (qw/utf8 allow_nonref max_size inflate_boolean inflate_nan inflate_null inflate_infinity/) {
        my $attr_accessor = 
JSON5 ( K/KA/KARUPA/JSON5-0.01.tar.gz, KARUPA, 2016; MetaCPAN )
JSON5/lib/JSON5/Parser.pm ( view source; MetaCPAN )
package JSON5::Parser;
use strict;
use warnings;
use utf8;

use Carp qw/croak/;
use JSON::PP;
use Encode;

our $ROOT;
our $POINTER;

sub new {
    my $class = shift;
    return bless +{
        utf8  
 => 0,
        max_size         => 0,
        inflate_boolean  => sub { $_[0] eq 'true' ? JSON::PP::true : JSON::PP::false },
        inflate_nan      => sub { 0+'NaN' },
        inflate_null     => s
 = length $content;
        $bytes <= $max_size
            or croak sprintf 'attempted decode of JSON5 text of %s bytes size, but max_size is set to %s', $bytes, $max_size;
    }
    if ($self->{utf8

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