Archive of UserLand's first discussion group, started October 5, 1998.

Re: XML-RPC, Object serialization, Perl

Author:Ken MacLeod
Posted:1/13/1999; 8:54:32 AM
Topic:XML-RPC, Object serialization, Perl
Msg #:2093 (In response to 2081)
Prev/Next:2092 / 2094

Frontier::RPC converts s to Perl hashes, s to Perl arrays, and all others to Perl scalars.

To call an RPC server, use Frontier::Client:

use Frontier::Client;

$server = Frontier::Client->new(url => $url);

$result = $server->call($method, @args);

$url is the URL of the XML-RPC server, like `', $method is the XML-RPC procedure name to call, and @args is a list of hashes, arrays, or scalars to pass to the procedure.

To create an XML-RPC server, use Frontier::Daemon. Frontier::Daemon is a subclass of HTTP::Daemon, so takes all the options that HTTP::Daemon takes for setting up a server, such as the port number. In addition, Frontier::Daemon takes a `methods' option that is a hash containing the RPC procedure names and references to Perl subroutines:

use Frontier::Daemon;

Frontier::Daemon->new(methods => { 'rpcName' => &sub_name, });

The subroutines get called with the XML-RPC parameters as hashes, arrays, and scalars.

This page was archived on 6/13/2001; 4:47:15 PM.

© Copyright 1998-2001 UserLand Software, Inc.