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

How to push Perl hash through XML RPC?

Author:Skip Montanaro
Posted:1/19/1999; 6:24:12 AM
Topic:Frontier on MacOS X Server
Msg #:2227 (In response to 2215)
Prev/Next:2226 / 2228

I have the following simple Perl script:

use Frontier::Client;
use strict;

my $host = 'dolphin.calendar.com'; my $port = 8000;

my $server = Frontier::Client->new(host => $host, port => $port);

my $method = 'test'; my %hash = ('state1' => 18, 'state2' => 27, 'state3' => 4); my @args = (%hash);

my $result = $server->call($method, @args); print "$result\n";

On the server end the parameter comes through as a series of strings:



test

state1
18
state2
27
state3
4


If I change the definition of %hash to

my %hash = {'state1' => 18, 'state2' => 27, 'state3' => 4};

I again see a couple strings, but something that looks like an id string of some sort:



test

HASH(0x81692e0)



Also, I'm getting all sorts of XML::Parser errors on the client side like:

XML::Parser::die(XML::Parser=HASH(0x80e94bc) unknown RPC type `value')

What do I need to do to get a hash encoded properly and sent to the server as a ?

Thanks,

Skip Montanaro skip@calendar.com


There are responses to this message:


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

© Copyright 1998-2001 UserLand Software, Inc.