NAME

CWB::CQI::Server - launch private CQPserver on local machine

SYNOPSIS

use CWB::CQI::Server;
use CWB::CQI::Client;

if (cqi_server_available()) {
  my @details = cqi_server();
  cqi_connect(@details);
  ...
}

DESCRIPTION

The CWB::CQI::Server module can be used to launch a private CQPserver on the local machine, which CWB::CQI::Client can then connect to.

Note that this is only possible if a suitable version of the IMS Open Corpus Workbench and the CWB Perl module have been installed. Availability must therefore be checked with the cqi_server_available function before calling cqi_server.

FUNCTIONS

$ok = cqi_server_available();

Returns a true value if a suitable CQPserver binary is installed on the local machine and can be started with the cqi_server function.

($user, $passwd, $host, $port) = cqi_server();
@details = cqi_server($flags);

cqi_server() searches for a free port on the local machine, then launches a single-user CQPserver process and returns the connection details required by the cqi_connect function from CWB::CQI::Client (in the appropriate order). The simplest way to establish a connection with a private, local CQPserver is

cqi_connect(cqi_server());

Be sure to check with cqi_server_available whether the required cqpserver command-line program is available first.

An optional argument to cqi_server is appended to the cqpserver command-line flags and can be used to specify further start-up options (e.g. to read a macro definition file). Keep in mind that arguments containing shell metacharacters need to be quoted appropriately.

WARNING: Since CQPserver runs as a separate process in the background, it is important to establish a connection as soon as possible. If the user's program aborts before cqi_connect is called and contacts the new CQPserver, this process will accept further connections from other users (on the local machine), which might compromise confidential data.

COPYRIGHT

Copyright (C) 1999-2020 Stefan Evert [http::/purl.org/stefan.evert]

This software is provided AS IS and the author makes no warranty as to its use and performance. You may use the software, redistribute and modify it under the same terms as Perl itself.