in reply to Accessing Trac via XML::RPC
may also be written:my $result = $xmlrpc->call( 'examples.getStateStruct', { state1 => 12, state2 => 28 } );
The i4 designates the XML::RPC data type (4-byte integer).my $result = $xmlrpc->call('examples.getStateStruct', { state1 => sub { {i4 => 12} }, state2 => 28 }
This example:
will add a named parameter called 'name' with a data type of 'base64'. This is a way of passing arbitrary binary data.$xmlrpc->call( 'method_name', { name => sub { {'base64' => encode_base64($data)} } } );
Since perl doesn't have a special way to designate boolean values, you have to do this to pass boolean typed parameters:
It would be a good idea to make sure that $value is either 0 or 1.$xmlrpc->call(..., { name => sub { {boolean => $value} } });
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.
|
|---|