You need to specify at least the server hostname and TCP port to connect a Event::RPC server instance. If the server requires a SSL connection or user authentication you need to supply the corresponding options as well, otherwise connecting will fail.

All options described here may be passed to the new() constructor of Event::RPC::Client. As well you may set or modify them using set_OPTION style mutators, but not after connect() was called! All options may be read using get_OPTION style accessors.

This is reference to a list of classes which should be imported into the client. You get a warning if you request a class which is not exported by the server.

By default all server classes are imported. Use this feature if your server exports a huge list of classes, but your client doesn't need all of them. This saves memory in the client and connect performance increases.

Optionally you can map the class names from the server to a different name on the local client using the class_map hash.

This is necessary if you like to use the same classes locally and remotely. Imported classes from the server are by default registered under the same name on the client, so this conflicts with local classes named identically.

On the client you access the remote classes under the name assigned in the class map. For example with this map

If the server accepts only SSL connections you need to enable ssl here in the client as well. By default the SSL connection will be established without any peer verification, which makes Man-in-the-Middle attacks possible. If you want to prevent that, you need to set either ssl_ca_file or ssl_ca_path option.

This optional parameter takes a hash reference of options passed to IO::Socket::SSL->new(...) to have more control over the SSL connection. For example you can set the 'SSL_verifycn_name' here if the server certificate common name doesn't match to the hostname you use to resolve the server IP or use you have to use a static server IP address or something like that.

The corresponding password, encrypted using Perl's crypt() function, using the username as the salt.

Event::RPC has a convenience function for generating such a crypted password, although it's currently just a wrapper around Perl's builtin crypt() function, but probably this changes someday, so better use this method:

$crypted_pass = Event::RPC->crypt($user, $pass);

If the passed credentials are invalid the Event::RPC::Client->connect() method throws a correspondent exception.

The Storable module is known to be insecure, so it should be taken as the last option only. By default the Client would do so. You can prevent that by setting this option explicitely to 0. It's enabled by default. Most likely the connection will fail in that case, because the server only will offer Storable if no other serialiser is available.

Any exceptions thrown on the server during execution of a remote method will result in a corresponding exception on the client. So you can use normal exception handling with eval {} when executing remote methods.

But besides this the network connection between your client and the server may break at any time. This raises an exception as well, but you can override this behaviour with the following attribute:

This subroutine is called if any error occurs in the network communication between the client and the server. The actual Event::RPC::Client object and an error string are passed as arguments.

This is no generic exception handler for exceptions thrown from the executed methods on the server! If you like to catch such exceptions you need to put an eval {} around your method calls, as you would do for local method calls.

By default Event::RPC does not handle network packages which exceed 2 GB in size (was 4 MB with version 1.04 and earlier).

You can change this value using this method at any time, but 4 GB is the maximum. An attempt of the server to send a bigger packet will be aborted and reported as an exception on the client and logged as an error message on the server.