NAME

Server::FastPL::Server - Add client-server behavior to scripts.

VERSION

This document refers to version 1.00 of Server::FastPL::Server, released April 10, 2000.

SYNOPSIS

use Server::FastPL::Server

my $fps = new Server::FastPL::Server(NAME=>"Test",MAX_CHILDS=>5,DEBUG=>1);
   
while ($client = $fps->receive_connect()) {
   ...
}

DESCRIPTION

Overview

This module adds server behavior to non-server scripts. It works by forking your script into MAX_CHILDS child processes. Unix sockets are used for communicating between the server children and the client script (see Server::FastPL::Client). The model loosely resembles CGI::Fast.

Contructor and initialization

$fps = new Server::FastPL::Server( # REQUIRED: This is the name of the socket file NAME => "Test", # Socket files dir. "/tmp/" as default. SOCKET_DIR => "/tmp/", # Number of children to fork, 5 as default. MAX_CHILDS => 5, # Debug flag for child processes. 0 as default. DEBUG => 0 ) || die $!;

Class and object methods

$client = $fps->receive_connect();

This method waits for a connection and returns a FileHandle (a Socket) for input/output to the server.

ENVIRONMENT

Signals:

This module uses two signals: USR1 and CHLD. Do not use these in your script or the server will not work.

Child processes:

The number of running child processes, established by MAX_CHLD, is maintained by the mother process.

DIAGNOSTICS

All error messages are passed to $!. Use it in your script to detect errors.

BUGS

Currently the environment hash (%ENV) is not automatically passed from the client to the server. If you want this functionality you must do this yourself (using this object's socket :) .

FILES

The module creates the folowing files in directory SOCKET_DIR:

NAME The main socket
NAME.x A socket for each child
NAME.fifo Communication between the mother and children processes.

SEE ALSO

Server::FastPL::Client IO::Socket

AUTHOR

Daniel Ruoso (daniel@ruoso.com)

COPYRIGHT

Copyright (c) 2000, Daniel Ruoso. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms of Perl itself

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 83:

'=item' outside of any '=over'

Around line 92:

You forgot a '=back' before '=head1'