NAME
RPC::Lite::Client - Lightweight RPC client framework.
SYNOPSIS
use RPC::Lite::Client;
my $client = RPC::Lite::Client->new(
{
Transport => 'TCP:Host=blah.foo.com,Port=10000',
Serializer => 'JSON', # JSON is actually the default,
# this argument is unnecessary
}
);
my $result = $client->Request('HelloWorld');
DESCRIPTION
RPC::Lite::Client implements a very lightweight remote process communications client framework. It can use arbitrary Transport (RPC::Lite::Transport) and Serialization (RPC::Lite::Serializer) mechanisms.
- Supported Arguments
-
- Serializer
-
A string specifying the RPC::Lite::Serializer to use when communicating with the server. See 'perldoc RPC::Lite::Serializers' for a list of supported serializers.
- Transport
-
A string specifying the transport layer to use to connect to the server. The string is of the format:
<transport type>[:[<argument>=<value>[,<argument>=<value>...]]]
Eg, for a TCP connection to the host 'blah.foo.com' on port 10000:
TCP:Host=blah.foo.com,Port=10000
See 'perldoc RPC::Lite::Transports' for a list of supported transport mechanisms.
- ManualConnect
-
A boolean value indicating whether or not you wish to connect manually, rather than at object instantiation. If set to true, you are required to call Connect() on the client object before attempting to make requests.
- DieOnError
-
If true, errors from the server will die(). If false, a warning will be emitted (warn()) and undef will be returned from
Request
. True by default.
new
Creates a new RPC::Lite::Client object. Takes a hash reference of arguments.
Connect()
Explicitly connects to the server. If this method is not called, the client will attempt to automatically connect when the first request is sent.
Request($methodName[, param[, ...]])
Sends a request to the server. Returns a native object that is the result of the request.
AsyncRequest($callBack, $methodName[, param[, ...]])
Sends an asynchronous request to the server. Takes a callback code reference. After calling this, you'll probably want to call HandleResponse in a loop to check for a response from the server, at which point your callback will be executed and passed a native object which is the result of the call.
RequestResponseObject($methodName[, param[, ...]])
Sends a request to the server. Returns an RPC::Lite::Response object.
May be mixed in with calls to AsyncRequest. Not threadsafe.
AsyncRequestResponseObject($callBack, $methodName[, param[, ...]])
Sends an asynchronous request to the server. Takes a callback code reference. After calling this, you'll probably want to call HandleResponse in a loop to check for a response from the server, at which point your callback will be executed and passed an RPC::Lite::Response object holding the result of the call.
Notify($methodName[, param[, ...]])
Sends a 'notification' to the server. That is, it makes a request, but expects no response.
HandleResponse([$timeout])
Checks for a response from the server. Useful mostly in conjunction with AsyncRequest. You can pass a timeout, or the Transport's default timeout will be used. Returns an Error object if there was an error, otherwise returns undef.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 43:
You can't have =items (as at line 60) unless the first thing after the =over is an =item
=over without closing =back