XML-RPC Client with Perl


Given a choice, try to use the Frontier::Client module. Do try to avoid RPC::XML

#!/usr/bin/perl -w

use Frontier::Client;

# Make an object to represent the XML-RPC server.
$server_url = 'http://betty.userland.com/RPC2';
$server = Frontier::Client->new(url => $server_url);
    
# Call the remote server with the method and arguments.
$result = $server->call('examples.getStateName', 5);

$state = $result;
    
print "State: $state\n";

If you need to an array of elements as argument, and read them back as array from the request, this is what you do :

$result = $server->call('examples.method', \@my_array);

my %values = %$result;
foreach ( keys %values ) {
    print "$values{$_}\n";
}