ljr/local/cgi-bin/LJR/xmlrpc.pm

29 lines
558 B
Perl
Raw Permalink Normal View History

2019-02-05 21:49:12 +00:00
use strict;
package LJR::xmlrpc;
sub xmlrpc_call {
my ($xmlrpc, $method, $request) = @_;
my $res;
if ($xmlrpc) {
$res = $xmlrpc->call ($method, $request);
if ($res && $res->fault) {
$res->{"err_text"} = $method . ": " . "XML-RPC Error [" . $res->faultcode . "]: " . $res->faultstring;
}
elsif (!$res) {
$res->{"err_text"} = $method . ": " . "Unknown XML-RPC Error.";
}
$res->{"result"} = $res->result;
}
else {
$res->{"err_text"} = "Invalid xmlrpc object";
}
return $res;
}
return 1;