NAME
PrimObject - Perl Remote Invocation of Methods object client class
SYNOPSIS
use PrimObject;
my $perl_bean_server = PrimObject->Prim_constructor("name" [, "server"]);
my $remote_object = $perl_bean_server->make_object(1, 2, 3);
my @answer = $remote_object->method(2);
print "@answer\n";
DESCRIPTION
This class is a prim (Perl Remote Invocation of Methods) client. You can use it to avoid learning and using the xml based prim protocols yourself (though you are welcome to do that).
First, you must make a client by calling Prim_constructor on this class. Supply the registered name of the service you want to contact. You may now call any regular method exposed by the server. If any of those generates objects, you call it in the same way storing the return. This class gives you a blessed reference which will behave just like the object the server constructed for you. When you call methods on it, this class repackages them as prim calls, passes them to the server (which breaks them apart into method name an arguments, and calls the method of the object), waits for the reply, parses it and passes it back to you.
INTERNALS
This client uses prim protocols (which are valid xml) to send your requests to the server. It initiates a connection to an prim object server (usually implemented via PrimObjectServer, clever naming huh?) in the constructor. It does this using the helper class PrimObjectClient.pm. That connection is maintained until the original instance of this class is ready for destruction and garbage collection. At that point the server is notified that you are finished.
BUGS
There are no timeouts.
EXPORT
This is currently an object oriented module with no exports. This may change.
AUTHOR
Phil Crow, philcrow2000@yahoo.com
SEE ALSO
The files objectclient and client in the distribution have examples of using this module and its cousin Prim.pm.
new
This constructor takes the name of a service and optionally a server (at some point in the future, leaving out the server will cause discovery across the network, currently the server ignores the server name and uses localhost in all cases). It then locates the port number of the needed service. (At present it looks for a file in the /tmp directory called name.prim where name is the one passed in. This is handled by the _discover method which can and should be replaced with a more sophisticated scheme.)
Having located the machine and port number for the service, new builds a PrimClient object, stores it in a typical hash, blesses a reference to that hash, and returns the reference to the caller.