-=| Boris Pek, 07.08.2013 23:35:41 +0400 |=- > > Please find attached a patch that adapts eiskaltdcpp-cli to > > libjson-rpc-perl 1.03 (just uploaded to experimental). > > > > JSON-RPC's upstream has changed (some two years ago), and that change led > > to > > some reorganisation, resulting in JSON::RPC::Client being renamed to > > JSON::RPC::Legacy::Client. > > I do not like this patch. Sorry. > 1) It is not suitable for upstream. > 2) It forces using of libjson-rpc-perl >= 1.03. For example, this > will increase > difference with package in backports. > > Is it possible to check which version is available and to load module > depending > on the result?
Alright. Please find attached a patch that would work with either old or new RPC-JSON at the expense of some code bloat. Thanks for the quick response!
>From dacae60779dd6b397d6cbc56e9453049953ad42d Mon Sep 17 00:00:00 2001 From: Damyan Ivanov <d...@debian.org> Date: Wed, 7 Aug 2013 21:43:16 +0200 Subject: [PATCH] adapt to JSON-RPC 1.03 --- eiskaltdcpp-cli/cli-jsonrpc.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/eiskaltdcpp-cli/cli-jsonrpc.pl b/eiskaltdcpp-cli/cli-jsonrpc.pl index 1fc3bb8..6f62a5c 100755 --- a/eiskaltdcpp-cli/cli-jsonrpc.pl +++ b/eiskaltdcpp-cli/cli-jsonrpc.pl @@ -25,7 +25,6 @@ use strict; use warnings; no warnings 'uninitialized'; use 5.012; -use JSON::RPC::Client; use Term::ShellUI; use Data::Dumper; use Getopt::Long; @@ -88,7 +87,14 @@ $obj->{'jsonrpc'} = $config{jsonrpc}; my $res; # creating and configuring jsonrpc client -my $client = new JSON::RPC::Client; +my $client = eval { + require JSON::RPC::Client; + JSON::RPC::Client->new(); +} or do { + require JSON::RPC::Legacy::Client; + JSON::RPC::Legacy::Client->new(); +}; + $client->version("2.0"); $client->ua->timeout(10); #$client->ua->credentials('http://127.0.0.1:3121', 'jsonrpc', 'user' => 'password'); -- 1.8.4.rc1