NAME

PrimObjectClient - a helper module for PrimObject.pm

SYNOPSIS

use PrimObjectClient;

# Initiates connection to server.
my $tcp_client = PrimObjectClient->new('host', $port_number);

# Calls method in the server.
print $tcp_client->call("method", @arguments);

# First, send docs for method and method2.
print $tcp_client->send_documentation("method", "method2");

# Now, send all docs.
print $tcp_client->send_documentation();

DESCRIPTION

This class is a helper provided to make implementing object receiving prim clients easier. Scripts should usually instantiate a PrimObject instead of coming directly here. If you want to reimplement this module, you may be better off going directly to the protocols file in the distribution.

This class provides a single continuous tcp connected session to a server whose host and port you pass to the constructor. Each call is packaged as a proper prim message and sent to the server. The response is checked for errors. Such errors cause this class issue a die, if you don't want to die, use eval to trap these fatal errors. If the response is not an error, it is passed unaltered (still in xml) to the caller. Documentation requests are handled separately, but in the same manner.

EXPORT

None.

AUTHOR

Phil Crow, philcrow2000@yahoo.com

new

This constructor merely stores the host and port information it receives in a hash, and returns a blessed reference to it.

call

Initiates a connection to the server specified in the constructor. Sends a properly formatted xml request for that server to run the method passed as the first argument by the caller with the remaining arguments passed through the server's function.

Takes a method name and a list of arguments to that method.

Returns a list of the return values produced by the server.

Handles all xml details.

This routine should have a timeout.