X-Git-Url: http://git.indexdata.com/?p=simpleserver-moved-to-github.git;a=blobdiff_plain;f=SimpleServer.pm;h=6e8841a408ad380b52229f1ca1b4b290777b5bb1;hp=e0cfda4862be37ae8757664001c4a3c5385f794a;hb=aa7443b391681a7f67c05fe1ca86a5b214e92e0c;hpb=8af01c7d35a10853213103bdbdcc67e0d9137b75 diff --git a/SimpleServer.pm b/SimpleServer.pm index e0cfda4..6e8841a 100644 --- a/SimpleServer.pm +++ b/SimpleServer.pm @@ -96,7 +96,9 @@ sub launch_server { if (defined($self->{DELETE})) { set_delete_handler($self->{DELETE}); } - + if (defined($self->{START})) { + set_start_handler($self->{START}); + } start_server(@args); } @@ -242,6 +244,7 @@ environments) whenever a new connection is received. The programmer can specify subroutines to take care of the following type of events: + - Start service (called once). - Initialize request - Search request - Present request @@ -264,6 +267,7 @@ The Perl programmer specifies the event handlers for the server by means of the SimpleServer object constructor my $z = new Net::Z3950::SimpleServer( + START => \&my_start_handler, INIT => \&my_init_handler, CLOSE => \&my_close_handler, SEARCH => \&my_search_handler, @@ -307,6 +311,23 @@ application invocation: In particular, you need to use the -T switch to start your SimpleServer in threaded mode. +=head2 Start handler + +The start handler is called when service is started. The argument hash +passed to the start handler has the form + + $args = { + CONFIG => "default-config" ## GFS config (as given by -c) + }; + + +The purpose of the start handler is to read the configuration file +for the Generic Frontend Server . This is specified by option -c. +If -c is omitted, the configuration file is set to "default-config". + +The start handler is optional. It is supported in Simpleserver 1.16 and +later. + =head2 Init handler The init handler is called whenever a Z39.50 client is attempting