kage Mojo::JSON::Any;
use strict;
use warnings;
our $VERSION = '0.990105';
use Mojo::JSON;
use constant JSONXS => ($ENV{MOJO_JSON})
? 0
: eval { require JSON::XS; require Mojo::JSON::XS; 1 };
{ shift; JSONXS ? Mojo::JSON::XS->new(@_) : Mojo::JSON->new(@_) }
1;
__END__
=head1 NAME
Mojo::JSON::Any - Use JSON::XS when it's available (DEPRECATED)
=head1 SYNOPSIS
use Mojo::JSON::Any;
my $json = Mojo::JSON::Any->new;
my $string = $json->encode({foo => [1, 2], bar => 'hello!'});
my $hash = $json->decode('{"foo": [3, -2, 1]}');
=head1 DESCRIPTION
This modules is DEP
package Mojo::JSON::XS;
use strict;
use warnings;
use base 'Mojo::Base';
use JSON::XS;
use Mojo::ByteStream 'b';
# Literal names
our $FALSE = JSON::XS::false;
our $TRUE = JSON::XS::true;
# Byte
[^\0]\0\0\0" => 'UTF-32LE',
"[^\0]\0[^\0]\0" => 'UTF-16LE'
};
__PACKAGE__->attr('_jsonxs' => sub { JSON::XS->new->convert_blessed(1) });
__PACKAGE__->attr('error');
sub decode {
my ($self
_jsonxs->decode($string);};
if ($@) {
$self->_exception($string, $@);
return;
}
return $result;
}
sub encode {
my ($self, $ref) = @_;
my $string = $self->_jsonx