From e80e1b1371be63ae80ebb768755283ef856ab533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Aperghis-Tramoni?= Date: Fri, 9 Feb 2018 15:16:02 +0100 Subject: [PATCH 1/2] avoid warnings about given & when with recent versions of Perl --- lib/Zabbix/API.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Zabbix/API.pm b/lib/Zabbix/API.pm index a108542..e3202f2 100644 --- a/lib/Zabbix/API.pm +++ b/lib/Zabbix/API.pm @@ -3,6 +3,7 @@ package Zabbix::API; use strict; use warnings; use 5.010; +use experimental qw< switch >; use Params::Validate qw/:all/; use Carp qw/carp croak confess cluck/; From a6f714606ac572295bc69d7230aa2c64dcb30a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Aperghis-Tramoni?= Date: Fri, 9 Feb 2018 15:18:44 +0100 Subject: [PATCH 2/2] avoid "Cannot call method "apiinfo.version" without parameters." errors --- lib/Zabbix/API.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Zabbix/API.pm b/lib/Zabbix/API.pm index e3202f2..2ab1a5e 100644 --- a/lib/Zabbix/API.pm +++ b/lib/Zabbix/API.pm @@ -151,6 +151,9 @@ sub raw_query { $args{'jsonrpc'} = '2.0'; $args{'auth'} = $self->cookie || ''; $args{'id'} = $global_id++; + $args{'params'} //= {}; + delete $args{'auth'} + if grep /^$args{method}$/, qw< user.login apiinfo.version >; my $response = eval { $self->{ua}->post($self->{server}, 'Content-Type' => 'application/json-rpc',