Permalink
Browse files

CLI: fix work with libjson-rpc-perl >= 1.03

  • Loading branch information...
tehnick committed Aug 7, 2013
1 parent 584850d commit 767538d2b44410bf7508cf0c2dcf623d08afb548
Showing with 12 additions and 2 deletions.
  1. +12 −2 eiskaltdcpp-cli/cli-jsonrpc.pl
@@ -25,7 +25,7 @@
use warnings;
no warnings 'uninitialized';
use 5.012;
-use JSON::RPC::Client;
+use JSON::RPC;
use Term::ShellUI;
use Data::Dumper;
use Getopt::Long;
@@ -88,7 +88,17 @@ BEGIN
my $res;
# creating and configuring jsonrpc client
-my $client = new JSON::RPC::Client;
+my $client;
+if ( $JSON::RPC::VERSION >= 1.03 )
+{
+ require JSON::RPC::Legacy::Client;
+ $client = new JSON::RPC::Legacy::Client;
+}
+else
+{
+ require JSON::RPC::Client;
+ $client = new JSON::RPC::Client;
+}
$client->version("2.0");
$client->ua->timeout(10);
#$client->ua->credentials('http://127.0.0.1:3121', 'jsonrpc', 'user' => 'password');

0 comments on commit 767538d

Please sign in to comment.