Use JSON::PP instead of the (deprecated) JSON::Any
As suggeseted in pull request #48 by @abelbeck, this commit replaces the deprecated JSON::Any by JSON::PP. This only influences cloudflare users.
This commit is contained in:
commit
fbd62b7cce
2 changed files with 13 additions and 13 deletions
|
@ -44,7 +44,7 @@ REQUIREMENTS:
|
||||||
|
|
||||||
- Perl 5.014 or later
|
- Perl 5.014 or later
|
||||||
(you need the IO::Socket::SSL perl library for ssl-support,
|
(you need the IO::Socket::SSL perl library for ssl-support,
|
||||||
JSON::Any perl library for JSON support and
|
JSON::PP perl library for JSON support and
|
||||||
IO::Socket:INET6 perl library for ipv6-support)
|
IO::Socket:INET6 perl library for ipv6-support)
|
||||||
|
|
||||||
- Linux or probably any common Unix system
|
- Linux or probably any common Unix system
|
||||||
|
|
24
ddclient
24
ddclient
|
@ -1949,13 +1949,13 @@ EOM
|
||||||
## load_json_support
|
## load_json_support
|
||||||
######################################################################
|
######################################################################
|
||||||
sub load_json_support {
|
sub load_json_support {
|
||||||
my $json_loaded = eval {require JSON::Any};
|
my $json_loaded = eval {require JSON::PP};
|
||||||
unless ($json_loaded) {
|
unless ($json_loaded) {
|
||||||
fatal(<<"EOM");
|
fatal(<<"EOM");
|
||||||
Error loading the Perl module JSON::Any needed for cloudflare update.
|
Error loading the Perl module JSON::PP needed for cloudflare update.
|
||||||
EOM
|
EOM
|
||||||
}
|
}
|
||||||
import JSON::Any;
|
import JSON::PP (qw/decode_json/);
|
||||||
}
|
}
|
||||||
######################################################################
|
######################################################################
|
||||||
## geturl
|
## geturl
|
||||||
|
@ -4273,9 +4273,9 @@ sub nic_cloudflare_update {
|
||||||
|
|
||||||
# Strip header
|
# Strip header
|
||||||
$reply =~ s/^.*?\n\n//s;
|
$reply =~ s/^.*?\n\n//s;
|
||||||
my $response = JSON::Any->jsonToObj($reply);
|
my $response = eval {decode_json($reply)};
|
||||||
if ($response->{result} eq 'error') {
|
if (!defined $response || !defined $response->{result}) {
|
||||||
failed ("%s", $response->{msg});
|
failed ("invalid json or result.");
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4300,9 +4300,9 @@ sub nic_cloudflare_update {
|
||||||
|
|
||||||
# Strip header
|
# Strip header
|
||||||
$reply =~ s/^.*?\n\n//s;
|
$reply =~ s/^.*?\n\n//s;
|
||||||
$response = JSON::Any->jsonToObj($reply);
|
$response = eval {decode_json($reply)};
|
||||||
if ($response->{result} eq 'error') {
|
if (!defined $response || !defined $response->{result}) {
|
||||||
failed ("%s", $response->{msg});
|
failed ("invalid json or result.");
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4326,9 +4326,9 @@ sub nic_cloudflare_update {
|
||||||
|
|
||||||
# Strip header
|
# Strip header
|
||||||
$reply =~ s/^.*?\n\n//s;
|
$reply =~ s/^.*?\n\n//s;
|
||||||
$response = JSON::Any->jsonToObj($reply);
|
$response = eval {decode_json($reply)};
|
||||||
if ($response->{result} eq 'error') {
|
if (!defined $response || !defined $response->{result}) {
|
||||||
failed ("%s", $response->{msg});
|
failed ("invalid json or result.");
|
||||||
} else {
|
} else {
|
||||||
success ("%s -- Updated Successfully to %s", $domain, $ip);
|
success ("%s -- Updated Successfully to %s", $domain, $ip);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue