Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Accessing Trac via XML::RPC

by pc88mxer (Vicar)
on Jun 24, 2008 at 15:27 UTC ( [id://693750]=note: print w/replies, xml ) Need Help??


in reply to Accessing Trac via XML::RPC

This example in the XML::RPC documentation:
my $result = $xmlrpc->call( 'examples.getStateStruct', { state1 => 12, state2 => 28 } );
may also be written:
my $result = $xmlrpc->call('examples.getStateStruct', { state1 => sub { {i4 => 12} }, state2 => 28 }
The i4 designates the XML::RPC data type (4-byte integer).

This example:

$xmlrpc->call( 'method_name', { name => sub { {'base64' => encode_base64($data)} } } );
will add a named parameter called 'name' with a data type of 'base64'. This is a way of passing arbitrary binary data.

Since perl doesn't have a special way to designate boolean values, you have to do this to pass boolean typed parameters:

$xmlrpc->call(..., { name => sub { {boolean => $value} } });
It would be a good idea to make sure that $value is either 0 or 1.

Here's a succinct overview of XML-RPC data types: http://www.xmlrpc.com/spec

To learn more about anonymous subroutines (aka CODEREFs), have a look at perldoc perlsub.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://693750]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2026-04-22 08:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.