From 340f5c8eff5fb4baaac3b9d9c48aa974f7a489a3 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 11 Nov 2017 07:21:13 +0000 Subject: json: dynamically select tl internal or external json mode git-svn-id: svn://tug.org/texlive/trunk@45745 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPOBJ.pm | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLPOBJ.pm') diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 8dadf1723fd..82eaf531ce4 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -423,8 +423,6 @@ sub writeout_simple { sub as_json { my $self = shift; my %addargs = @_; - require JSON; - #my $json = JSON::PP->new->utf8; my %foo = %{$self}; # set the additional args for my $k (keys %addargs) { @@ -445,9 +443,9 @@ sub as_json { # encode boolean as boolean flags if (exists($foo{'relocated'})) { if ($foo{'relocated'}) { - $foo{'relocated'} = $JSON::true; + $foo{'relocated'} = TeXLive::TLUtils::True(); } else { - $foo{'relocated'} = $JSON::false; + $foo{'relocated'} = TeXLive::TLUtils::False(); } } # adjust the docfiles entry to the specification in JSON-formats @@ -469,11 +467,7 @@ sub as_json { $foo{'docfiles'} = [ @newdocf ]; delete($foo{'docfiledata'}); # - # my home-made solution is a bit faster then JSON::PP - # but we still prefer that one for security ;-) - # If JSON::XS is installed, that is the fastest. - #my $utf8_encoded_json_text = TeXLive::TLUtils::hash_to_json(\%foo); - my $utf8_encoded_json_text = JSON::encode_json(\%foo); + my $utf8_encoded_json_text = TeXLive::TLUtils::encode_json(\%foo); return $utf8_encoded_json_text; } -- cgit v1.2.3