IP, username and password have been substituted for generic ones. I'm trying to connect to the Zabbix API running on a test server. A test PHP script works fine. JSON::RPC::Client sits and complains that I'm not passing it a hash. Running it I get:#!/usr/bin/perl use JSON::RPC::Client; use Data::Dumper; my $client = new JSON::RPC::Client; my $url = 'http://9999.9999.9999.9999/api_jsonrpc.php'; my $callobj = { method => 'user.authenticate', params => ["admin","password"] }; print Dumper(ref($callobj)); my $sessionid = $client->call($url, $callobj); if($sessionid) { if ($sessionid->is_error) { print "Error : ", $sessionid->error_message; } else { print $sessionid->result; } } else { print $client->status_line; }
so I presumably know for sure that $callobj is a hash? I've also tried putting params in the format: params => { username=>"admin", password=>"password" } Again this was to no avail, same error message. line 194 relates to JSON::RPC::Client's returning section, "new" subroutine (194 line starts $content->{error} ):$VAR1 = 'HASH'; Not a HASH reference at /usr/local/share/perl/5.10.0/JSON/RPC/Client.p +m line 194.
Help me please perl monks, I'm utterly flummoxed.sub new { my ($class, $obj, $json) = @_; my $content = ( $json || JSON->new->utf8 )->decode( $obj->content +); my $self = bless { jsontext => $obj->content, content => $content, }, $class; $content->{error} ? $self->is_success(0) : $self->is_success(1); $content->{version} ? $self->version(1.1) : $self->version(0) ; $self; }
In reply to Grappling with JSON::RPC::Client by Garp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |