-
-
01 Mar 2007 13:14:23 UTC
- Distribution: XML-RPC
- Module version: 0.1
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (0)
- Testers (8 / 0 / 0)
- Kwalitee
Bus factor: 1- License: unknown
- Activity
24 month- Tools
- Download (3.63KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- LWP::UserAgent
- XML::TreePP
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- SYNOPSIS
- DESCRIPTION
- CONSTRUCTOR AND OPTIONS
- METHODS
- ERROR HANDLING
- PROXY SUPPORT
- LIMITATIONS
- AUTHOR
- COPYRIGHT AND LICENSE
NAME
XML::RPC -- Pure Perl implementation for an XML-RPC client and server.
SYNOPSIS
make a call to a XML-RPC server:
my $xmlrpc = XML::RPC->new('http://betty.userland.com/RPC2'); my $result = $xmlrpc->call( 'examples.getStateStruct', { state1 => 12, state2 => 28 } );
create a XML-RPC service:
use XML::RPC; use CGI; my $q = new CGI; my $xmlrpc = XML::RPC->new(); my $xml = $q->param('POSTDATA'); print $q->header( -type => 'text/xml', charset => 'UTF-8' ); print $xmlrpc->receive( $xml, \&handler ); sub handler { my ( $methodname, @params ) = @_; return { you_called => $methodname, with_params => \@params }; }
DESCRIPTION
XML::RPC module provides simple Pure Perl methods for XML-RPC communication. It's goals are simplicity and flexibility. XML::RPC uses XML::TreePP for parsing.
CONSTRUCTOR AND OPTIONS
$xmlrpc = XML::RPC->new();
This constructor method returns a new XML::RPC object. Usable for XML-RPC servers.
$xmlrpc = XML::RPC->new( 'http://betty.userland.com/RPC2', %options );
Its first argument is the full URL for your server. The second argument is for options passing to XML::TreePP, for example: output_encoding => 'ISO-8859-1' (default is UTF-8).
METHODS
$xmlrpc->call( 'method_name', @arguments );
This method calls the provides XML-RPC server's method_name with @arguments. It will return the server method's response.
$xmlrpc->receive( $xml, \&handler );
This parses an incoming XML-RPC methodCall and call the \&handler subref with parameters: $methodName and @parameters.
ERROR HANDLING
To provide an error response you can simply die() in the \&handler function. Also you can set the $XML::RPC::faultCode variable to a value just before dieing.
PROXY SUPPORT
Default XML::RPC will try to use LWP::Useragent for requests, you can set the environment variable: CGI_HTTP_PROXY to set a proxy.
LIMITATIONS
XML::RPC will not create "bool", "dateTime.iso8601" or "base64" types. They will be parsed as "int" or "string".
AUTHOR
Niek Albers, http://www.daansystems.com/
COPYRIGHT AND LICENSE
Copyright (c) 2007 Niek Albers. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install XML::RPC, copy and paste the appropriate command in to your terminal.
cpanm XML::RPC
perl -MCPAN -e shell install XML::RPC
For more information on module installation, please visit the detailed CPAN module installation guide.