NAME
Protocol::XMLRPC::MethodResponse - XML-RPC methodResponse response
SYNOPSIS
my $method_response = Protocol::XMLRPC::MethodResponse->new;
$method_response->param(1);
$method_response = Protocol::XMLRPC::MethodResponse->parse(...);
DESCRIPTION
XML-RPC methodResponse response object.
ATTRIBUTES
param
Hold method response parameter as object.
METHODS
new
Creates a new Protocol::XMLRPC::MethodResponse instance.
new_fault
my $method_response =
Protocol::XMLRPC::MethodResponse->new_fault(255 => 'Unknown error');
Creates a new Protocol::XMLRPC::MethodResponse instance with a fault.
parse
my $method_response = Protocol::XMLRPC::MethodResponse->parse('<?xml ...');
Creates a new Protocol::XMLRPC::MethodResponse from xml.
param
$method_response->param(1);
$method_response->param(Protocol::XMLRPC::Value::String->new('foo'));
my $param = $method_response->param;
Set/get parameter. Tries to guess a type if a Perl5 scalar/arrayref/hashref was passed instead of an object.
fault
$method_response->fault(255 => 'Unknown error');
my $fault = $method_response->fault;
Set/get XML-RPC fault struct.
fault_code
Shortcut for $method_response->fault->members->{faultCode}->value.
fault_string
Shortcut for $method_response->fault->members->{faultString}->value.
to_string
# normal response
my $method_response = Protocol::XMLRPC::MethodResponse->new;
$method_response->param('baz');
# <?xml version="1.0"?>
# <methodResponse>
# <params>
# <param>
# <value><string>baz</string></value>
# </param>
# </params>
# </methodResponse>
# fault response
my $method_response = Protocol::XMLRPC::MethodResponse->new;
$method_response->fault(255 => 'Unknown method');
# or
my $method_response =
Protocol::XMLRPC::MethodResponse->new_fault(255 => 'Unknown method');
# <?xml version="1.0"?>
# <methodResponse>
# <fault>
# <value>
# <struct>
# <member>
# <name>faultCode</name>
# <value><int>255</int></value>
# </member>
# <member>
# <name>faultString</name>
# <value><string>Unknown method</string></value>
# </member>
# </struct>
# </value>
# </fault>
# </methodResponse>
Protocol::XMLRPC::MethodResponse string representation.