TT#28473 force JSON::PP everywhere

Change-Id: I414c6f14cd3c4040b646229d38c5e8522208b5fb
changes/73/17873/1
Rene Krenn 7 years ago
parent b797a9bacc
commit 25f2619de1

@ -7,7 +7,7 @@ use threads::shared qw();
use String::MkPasswd qw();
#use List::Util qw();
use JSON qw();
use JSON -support_by_pp, -no_export;
use Tie::IxHash;
use NGCP::BulkProcessor::Projects::Migration::Teletek::Settings qw(

@ -1,5 +1,5 @@
use Net::Domain qw(hostfqdn);
use JSON qw();
use JSON -support_by_pp, -no_export;
use Test::More;
use Data::Dumper;
use LWP::UserAgent;

@ -8,7 +8,9 @@ use threads::shared qw(shared_clone);
use HTTP::Status qw(:constants :is status_message);
use JSON qw();
use Encode qw();
use JSON -support_by_pp, -no_export;
use IO::Uncompress::Unzip qw();
use NGCP::BulkProcessor::Globals qw(
@ -28,7 +30,7 @@ use NGCP::BulkProcessor::LogError qw(
fileerror
);
use NGCP::BulkProcessor::RestConnector qw(_add_headers);
use NGCP::BulkProcessor::RestConnector qw(_add_headers convert_bools);
use NGCP::BulkProcessor::Calendar qw(get_fake_now_string);
@ -61,6 +63,9 @@ my $faketime_header = 'X-Fake-Clienttime';
our $ITEM_REL_PARAM = 'item_rel';
#my $logger = getlogger(__PACKAGE__);
my $request_charset = 'utf-8';
my $response_charset = 'utf-8';
sub _get_api_cert_dir {
return $working_path . $API_CERT_DIR;
}
@ -187,13 +192,16 @@ sub _init_ssl_cert {
sub _encode_request_content {
my $self = shift;
my ($data) = @_;
return JSON::to_json($data);
return Encode::encode($request_charset,JSON::to_json($data,{ allow_nonref => 1, allow_blessed => 1, convert_blessed => 1, pretty => 0, }));
}
sub _decode_response_content {
my $self = shift;
my ($data) = @_;
return ($data ? JSON::from_json($data) : undef);
my $decoded;
$decoded = JSON::from_json(Encode::decode($response_charset,$data),{ allow_nonref => 1, }) if $data;
convert_bools($decoded);
return $decoded // $data;
}
sub _add_post_headers {

@ -45,7 +45,7 @@ use MIME::Base64 qw(encode_base64 decode_base64);
#http://blogs.perl.org/users/steven_haryanto/2010/09/comparison-of-perl-serialization-modules.html
use Storable; # qw( nfreeze thaw );
use JSON qw();
use JSON -support_by_pp, -no_export;
#use JSON::XS; # qw(encode_json decode_json);
use Data::Dump; # qw(dump);
@ -168,13 +168,13 @@ sub deserialize_xml {
sub serialize_json {
my $input_ref = shift;
#return JSON::XS::encode_json($input_ref);
return JSON::to_json($input_ref,{ allow_blessed => 1, convert_blessed => 1, pretty => 0 });
return JSON::to_json($input_ref, { allow_nonref => 1, allow_blessed => 1, convert_blessed => 1, pretty => 0 });
}
sub deserialize_json {
my $input_ref = shift;
#return JSON::XS::decode_json($input_ref);
return JSON::from_json($$input_ref);
return JSON::from_json($$input_ref, { allow_nonref => 1, });
}
sub serialize_yaml {

Loading…
Cancel
Save