Re: using the RPC::XML perl module, getting started
Bill Moseley <[email protected]> Thu, 13 Jan 2011 13:15:20 -0800
| Newsgroups | gmane.text.xml.rpc.specification |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jan 13, 2011 at 12:56 PM, Ted Pedersen <[email protected]> wrote: > > So...given that I have this server running, what should the client look > like > to get this going? > Well, I think those methods return a reference to a list. I don't have the fortune program, so I just replaced the code like this: RPC::XML::Server->new(port => 19000) # add_proc can take a pre-created RPC::XML::Procedure # object, or a hash reference. ->add_proc({ name => 'books', signature => [ 'array', 'array string', 'array array' ], code => sub { return [1,2,3]} }) And then the client: use strict; use warnings; use RPC::XML::Client; use Data::Dumper; my $client = RPC::XML::Client->new( 'http://localhost:19000' ); my $response = $client->send_request( 'books' ); print Dumper $response->value; Which returns: $VAR1 = [ '1', '2', '3' ]; You would want to add a bit more error handling, of course. Is that what you are after? -- Bill Moseley [email protected] [Non-text portions of this message have been removed] ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/xml-rpc/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/xml-rpc/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/