From: Anders S. Mortensen Date: Fri, 4 Jun 2004 09:57:00 +0000 (+0000) Subject: Added documentation for the new threaded mode. X-Git-Tag: release.0.0.8.lau~9 X-Git-Url: http://git.indexdata.com/?p=simpleserver-moved-to-github.git;a=commitdiff_plain;h=6a3d1dfe0107b554945ddc1c55ccd7478ae26a90 Added documentation for the new threaded mode. --- diff --git a/SimpleServer.pm b/SimpleServer.pm index ff1e62f..a295634 100644 --- a/SimpleServer.pm +++ b/SimpleServer.pm @@ -25,7 +25,7 @@ ## ## -## $Id: SimpleServer.pm,v 1.20 2004-05-28 20:14:28 sondberg Exp $ +## $Id: SimpleServer.pm,v 1.21 2004-06-04 09:57:00 sondberg Exp $ package Net::Z3950::SimpleServer; @@ -195,12 +195,12 @@ After the launching of the server, all control is given away from the Perl script to the server. The server calls the registered subroutines to field incoming requests from Z39.50 clients. -A reference to an anonymous hash is passed to each handle. Some of +A reference to an anonymous hash is passed to each handler. Some of the entries of these hashes are to be considered input and others output parameters. -The Perl programmer specifies the event handles for the server by -means of the the SimpleServer object constructor +The Perl programmer specifies the event handlers for the server by +means of the SimpleServer object constructor my $z = new Net::Z3950::SimpleServer( INIT => \&my_init_handler, @@ -210,7 +210,22 @@ means of the the SimpleServer object constructor SCAN => \&my_scan_handler, FETCH => \&my_fetch_handler); -After the custom event handles are declared, the server is launched +If you want your SimpleServer to start a thread (threaded mode) to +handle each incoming Z39.50 request instead of forking a process +(forking mode), you need to register the handlers by symbol rather +than by code reference. Thus, in threaded mode, you will need to +register your handlers this way: + + my $z = new Net::Z3950::SimpleServer( + INIT => "my_package::my_init_handler", + CLOSE => "my_package::my_close_handler", + .... + .... ); + +where my_package is the Perl package in which your handler is +located. + +After the custom event handlers are declared, the server is launched by means of the method $z->launch_server("MyServer.pl", @ARGV); @@ -220,6 +235,9 @@ script (for logging purposes), while the rest of the arguments are documented in the YAZ toolkit manual: The section on application invocation: +In particular, you need to use the -T switch to start your SimpleServer +in threaded mode. + =head2 Init handler The init handler is called whenever a Z39.50 client is attempting diff --git a/TODO b/TODO index 5187b57..2f902b2 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,9 @@ Todo list for the SimpleServer project: --------------------------------------- +-- Enforce symbol registration instead of code reference registration when + Simpleserver is running in threaded mode. + -- Add PID members to the argument hashes where they do not already occur. -- Fix memory leak in the Scan handle.