|
NAMERPC::Simple::Factory - Perl extension for creating RPC clientSYNOPSIS# with Tk use Tk; use RPC::Simple::Factory; my $mw = MainWindow-> new ; my $verbose = 1 ; # up to you # create factory my $factory = new RPC::Simple::Factory ( tk_top => $mw, verbose_ref => \$verbose ) ; # without Tk # create factory my $factory = new RPC::Simple::Factory() ; my $socket = $factory -> getSocket ; # create event loop DESCRIPTIONThis class handles all the tricky stuff involving socket handling. This module was originally written to be used with Tk. Now you can use it without Tk, in blocking mode or asynchronous mode.Methodsnew(...)Create the factory. One factory must be created for each remote host.Parameters are:
logmsg (...)print arguments if verbose mode.newRemoteObject( $owner_ref, [ remote_class_name ] ... )Will create a remote (the remote_class_name) object tied to the owner.Additional parameters will be passed as is to the remote 'new' method. getRemoteHostNamereturn the remote host namegetSocketReturns the socket created by Factory. So you can use it in your own event loop. When using Factory with Tk, the constructor will take care of registering the socket in Tk's event loop.writeSockBuffer ( agent_index, remote_method, request_id, parameter, [object_name])Encode the method, object, parameter and send it to the remote object.agent_index and request_id are used later for the call-back mechanism. readSockread pending data on the socket. Do an eval on the read data to call-back the relevent Agents.Note that there's no security implemented (yet). Static functionsspawn([port],[verbose])Will spawn a RPC::Simple server on your machine. Don't call this function if you need to do RPC on a remote machine.Return the server pid or null (just like fork) ON EXITWhen the object is destroyed, the 'END' routine will be called. This will kill the server if it was created by spawn.AUTHORSCurrent Maintainer Clint Edwards <cedwards@mcclatchyinteractive.com> Original Dominique Dumont, <Dominique_Dumont@grenoble.hp.com> SEE ALSOperl(1), RPC::Simple::Agent(3), RPC::Simple::AnyLocal(3).
Visit the GSP FreeBSD Man Page Interface. |