diff options
author | Norbert Preining <preining@logic.at> | 2017-11-11 07:21:13 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2017-11-11 07:21:13 +0000 |
commit | 340f5c8eff5fb4baaac3b9d9c48aa974f7a489a3 (patch) | |
tree | 8acc98f3a91723f63204ba4bdda21fdc2cce9a85 /Master/tlpkg/TeXLive/TLPDB.pm | |
parent | 7dd43e0f528f7f7c28d31cf49699dea37d2539f8 (diff) |
json: dynamically select tl internal or external json mode
git-svn-id: svn://tug.org/texlive/trunk@45745 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPDB.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 9176a04e715..32015fa692d 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -479,7 +479,6 @@ the tag of the sub-database, and C<tlpdb> giving the JSON of the database. sub as_json { my $self = shift; - require JSON; my $ret = "{"; if ($self->is_virtual) { my $firsttlpdb = 1; @@ -508,7 +507,7 @@ sub _as_json { if ($TeXLive::TLConfig::TLPDBOptions{$k}[0] =~ m/^n/) { $opts->{$k} += 0 if (exists($opts->{$k})); } elsif ($TeXLive::TLConfig::TLPDBOptions{$k}[0] eq "b") { - $opts->{$k} = ($opts->{$k} ? $JSON::true : $JSON::false) if (exists($opts->{$k})); + $opts->{$k} = ($opts->{$k} ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()) if (exists($opts->{$k})); } elsif ($k eq "location") { if (exists($opts->{$k})) { my %foo = TeXLive::TLUtils::repository_to_array($opts->{$k}); @@ -520,27 +519,27 @@ sub _as_json { } # the last else is plain strings, nothing to do } - $ret .= JSON::encode_json($opts); + $ret .= TeXLive::TLUtils::encode_json($opts); $ret .= ',"settings":'; my $sets = $self->settings; for my $k (keys %TeXLive::TLConfig::TLPDBSettings) { if ($TeXLive::TLConfig::TLPDBSettings{$k} eq "b") { - $sets->{$k} = ($sets->{$k} ? $JSON::true : $JSON::false) if (exists($sets->{$k})); + $sets->{$k} = ($sets->{$k} ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()) if (exists($sets->{$k})); } elsif ($TeXLive::TLConfig::TLPDBSettings{$k} eq "available_architectures") { delete($sets->{$k}); @{$sets->{$k}} = $self->available_architectures; } # else are strings } - $ret .= JSON::encode_json($sets); + $ret .= TeXLive::TLUtils::encode_json($sets); $ret .= ',"configs":'; my %cfgs; - $cfgs{'container_split_src_files'} = ($self->config_src_container ? $JSON::true : $JSON::false); - $cfgs{'container_split_doc_files'} = ($self->config_doc_container ? $JSON::true : $JSON::false); + $cfgs{'container_split_src_files'} = ($self->config_src_container ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()); + $cfgs{'container_split_doc_files'} = ($self->config_doc_container ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()); $cfgs{'container_format'} = $self->config_container_format; $cfgs{'release'} = $self->config_release; $cfgs{'minrelease'} = $self->config_minrelease; - $ret .= JSON::encode_json(\%cfgs); + $ret .= TeXLive::TLUtils::encode_json(\%cfgs); $ret .= ',"tlpkgs": ['; my $first = 1; foreach (keys %{$self->{'tlps'}}) { |