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
|
||||
(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)
|
||||
|
||||
- Linux or probably any common Unix system
|
||||
|
|
24
ddclient
24
ddclient
|
@ -1949,13 +1949,13 @@ EOM
|
|||
## load_json_support
|
||||
######################################################################
|
||||
sub load_json_support {
|
||||
my $json_loaded = eval {require JSON::Any};
|
||||
my $json_loaded = eval {require JSON::PP};
|
||||
unless ($json_loaded) {
|
||||
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
|
||||
}
|
||||
import JSON::Any;
|
||||
import JSON::PP (qw/decode_json/);
|
||||
}
|
||||
######################################################################
|
||||
## geturl
|
||||
|
@ -4273,9 +4273,9 @@ sub nic_cloudflare_update {
|
|||
|
||||
# Strip header
|
||||
$reply =~ s/^.*?\n\n//s;
|
||||
my $response = JSON::Any->jsonToObj($reply);
|
||||
if ($response->{result} eq 'error') {
|
||||
failed ("%s", $response->{msg});
|
||||
my $response = eval {decode_json($reply)};
|
||||
if (!defined $response || !defined $response->{result}) {
|
||||
failed ("invalid json or result.");
|
||||
next;
|
||||
}
|
||||
|
||||
|
@ -4300,9 +4300,9 @@ sub nic_cloudflare_update {
|
|||
|
||||
# Strip header
|
||||
$reply =~ s/^.*?\n\n//s;
|
||||
$response = JSON::Any->jsonToObj($reply);
|
||||
if ($response->{result} eq 'error') {
|
||||
failed ("%s", $response->{msg});
|
||||
$response = eval {decode_json($reply)};
|
||||
if (!defined $response || !defined $response->{result}) {
|
||||
failed ("invalid json or result.");
|
||||
next;
|
||||
}
|
||||
|
||||
|
@ -4326,9 +4326,9 @@ sub nic_cloudflare_update {
|
|||
|
||||
# Strip header
|
||||
$reply =~ s/^.*?\n\n//s;
|
||||
$response = JSON::Any->jsonToObj($reply);
|
||||
if ($response->{result} eq 'error') {
|
||||
failed ("%s", $response->{msg});
|
||||
$response = eval {decode_json($reply)};
|
||||
if (!defined $response || !defined $response->{result}) {
|
||||
failed ("invalid json or result.");
|
||||
} else {
|
||||
success ("%s -- Updated Successfully to %s", $domain, $ip);
|
||||
|
||||
|
|
Loading…
Reference in a new issue