ddclient: made json optional
As suggested in pull 7 on github by @abelbeck and @Bugsbane it is better to make the use of JSON related to the use of cloudflare. git-svn-id: svn+ssh://svn.code.sf.net/p/ddclient/code/trunk@181 3873ddee-7413-0410-b6c4-c2c57c1ab35a
This commit is contained in:
parent
79fe974a94
commit
ba6ec1cb70
1 changed files with 13 additions and 1 deletions
14
ddclient
14
ddclient
|
@ -25,7 +25,6 @@ use strict;
|
|||
use Getopt::Long;
|
||||
use Sys::Hostname;
|
||||
use IO::Socket;
|
||||
use JSON::Any;
|
||||
|
||||
# my ($VERSION) = q$Revision$ =~ /(\d+)/;
|
||||
|
||||
|
@ -1296,6 +1295,7 @@ sub init_config {
|
|||
$proto = opt('protocol') if !defined($proto);
|
||||
|
||||
load_sha1_support() if ($proto eq "freedns");
|
||||
load_json_support() if ($proto eq "cloudflare");
|
||||
|
||||
if (!exists($services{$proto})) {
|
||||
warning("skipping host: %s: unrecognized protocol '%s'", $h, $proto);
|
||||
|
@ -1875,6 +1875,18 @@ EOM
|
|||
}
|
||||
}
|
||||
######################################################################
|
||||
## load_json_support
|
||||
######################################################################
|
||||
sub load_json_support {
|
||||
my $json_loaded = eval {require JSON::Any};
|
||||
unless ($json_loaded) {
|
||||
fatal(<<"EOM");
|
||||
Error loading the Perl module JSON::Any needed for cloudflare update.
|
||||
EOM
|
||||
}
|
||||
import JSON::Any;
|
||||
}
|
||||
######################################################################
|
||||
## geturl
|
||||
######################################################################
|
||||
sub geturl {
|
||||
|
|
Loading…
Reference in a new issue