Clint Edwards > RPC-Simple-1.002 > RPC::Simple::Server

Download:
RPC-Simple-1.002.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.8   Source  

NAME ^

RPC::Simple::Server - Perl class to use in the RPC server script.

SYNOPSIS ^

  use RPC::Simple::Server;

 my $server_pid = &spawn ;

DESCRIPTION ^

Generic server class. The mainLoop function will instantiate one server object for each connection request.

Server also provides functions (childDeath) to monitor children processes.

Exported static functions ^

mainLoop

To be called at the end of the main program. This function will perform the select loop, and call relevant server objects.

goodGuy([ipaddress|host_name])

Declare the IP address or the host name as a buddy. Connection from buddies will be accepted. localhost is always considered as a good guy.

registerChild($object_ref, $pid)

Register process $pid as a process to be monitored by server. $object_ref is the process manager of this child. $object_ref::process_over will be called back when (or shortly after) the child dies.

unregisterChild($pid)

unregister process $pid. Does not call-back the process manager.

childDeath

Static function called when a child dies. $SIG{CHLD} must be set to \&childDeath by the user.

CONSTRUCTOR ^

Called by mainloop. Construct a server. Currently only one server is supported.

METHODS ^

acceptSocket

called by new. By default, accepts only connection from localhost (127.0.0.1).

writeSock(index_of_agent, method, reqId, param, [objectName ])

Called by Object handler to send data back to Agent.

param: array_ref of parameters passed to the call-back function.

readClient

Read the client's socket. Execute the code passed through the socket and call the relevant object handlers.

returns 0 if the socket is closed.

close

Close the connection.

setMask(object,method, file_number)

Function used by any object controlling a child process. Register the object and the method to call back when reading from the passed file descriptor.

file_number is as given by fileno

resetMask

To be called when the child process is dead.

getFileno

Returns the fileno of the client's socket.

CAVEATS ^

Some function are provided to handle remote processes. These functions are not yet tested. They may not stay in this class either.

AUTHORS ^

    Current Maintainer
    Clint Edwards <cedwards@mcclatchyinteractive.com>

    Original
    Dominique Dumont, <Dominique_Dumont@grenoble.hp.com>

SEE ALSO ^

perl(1).

syntax highlighting: