The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

NexTrieve::Daemon - handle NexTrieve running as a daemon

SYNOPSIS

 use NexTrieve;
 die unless NexTrieve::Daemon->executable;

 $ntv = NexTrieve->new( | {method => value} );

 # using collections
 $collection = $ntv->Collection( path );
 $daemon = $collection->Daemon( mnemonic );

 # using direct access
 $resource = $ntv->Resource( | file | xml | {method => value} );
 $daemon = $ntv->Daemon( | file | $resource, | server:port, | {method => value} );

DESCRIPTION

The Daemon object of the Perl support for NexTrieve. Do not create directly, but through the Daemon method of the NexTrieve or the NexTrieve::Collection object.

CLASS METHODS

These methods are available as class methods.

executable

 $executable = NexTrieve::Daemon->executable;
 ($program,$expiration,$software,$database,$threaded) = NexTrieve::Daemon->executable;

Return information about the associated NexTrieve program "ntvsearchd".

The first output parameter contains the full program name of the NexTrieve executable "ntvsearchd". It contains the empty string if the "ntvsearchd" executable could not be found or is not executable by the effective user. Can be used as a flag. Is the only parameter returned in a scalar context.

If this method is called in a list context, an attempt is made to execute the NexTrieve program "ntvsearchd" to obtain additional information. Then the following output parameters are returned.

The second output parameter returns the expiration date of the license that NexTrieve is using by default. If available, then the date is returned as a datestamp (YYYYMMDD).

The third output parameter returns the version of the NexTrieve software that is being used. It is a string in the form "M.m.rr", whereby "M" is the major release number, "m" is the minor release number and "rr" is the build number.

The fourth output parameter returns the version of the internal database that will be created by the version of the NexTrieve software that is being used. It is a string in the form "M.m.rr", whereby "M" is the major release number, "m" is the minor release number and "rr" is the build number.

The fifth output parameter returns a flag whether this version of the NexTrieve software is threaded or not.

OBJECT METHODS

These methods are available to the NexTrieve::Daemon object.

Resource

 $resource = $daemon->Resource;
 $daemon->Resource( $resource | file | xml | {method => value} );

The "Resource" method is primarily intended to allow you to obtain the NexTrieve::Resource object that is (indirectly) created when the NexTrieve::Daemon object is created. If necessary, it can also be used to create a new NexTrieve::Resource object associated with the NexTrieve::Daemon object.

See the NexTrieve::Resource module for more information.

OTHER METHODS

These methods are available to the NexTrieve::Daemon object.

auto_shutdown

 $daemon->auto_shutdown( true | false );
 $auto_shutdown = $daemon->auto_shutdown;

The "autoshutdown" method specifies whether the server process that is started with start should be automatically stopped when the NexTrieve::Daemon object is destroyed. By default, the server process will _not_ be shut down when the object is destroyed.

indexdir

 $daemon->indexdir( directory );
 $directory = $daemon->indexdir;

The "indexdir" method specifies an indexdirectory other than the indexdirectory that is specified in the Resource object. By default, the indexdirectory information from the Resource object is used.

pid

 $pid = $daemon->pid;

The "pid" method returns the process-id (or PID) of the server process. It sets an error if the PID could not be found, in which case it will also return undef.

pidfile

 $pidfile = $daemon->pidfile;

The "pidfile" method returns the absolute path where the file that contains the process-id (or PID) of the server process.

ping

 $alive = $daemon->ping;

The "ping" method returns whether the server process associated with the NexTrieve::Daemon object, is still running.

restart

 $daemon->restart;

The "restart" method indicates that the current server process associated with the NexTrieve::Daemon object, should be stopped and a new server process, using the specifics of the current NexTrieve::Daemon object, should be started. Check the pid method afterwards to check whether a server process has started. Use the start method to start a server process and the stop method to stop a server process.

serverport

 $daemon->serverport( server:port | port );
 $serverport = $daemon->serverport;

The "serverport" method specifies which server address and port should be used by the server process of this NexTrieve::Daemon object. The input parameter may consist of:

- just a port number

If you want to have the server process bind to the "localhost" address, then just specifying the port number to which the server process should bind, is enough. See the "anyport" method of the NexTrieve.pm module to obtain a random port number if you don't know of one yourself.

- server:port specification

If you specify a server name or IP-address and a port number seperated by a colon, then the server process will attempt to bind to the port number and the interface that is handling the (implicitely) specified IP-number.

start

 $daemon->start( | server:port | port, | user );

The "start" method allows you to start a server process. The first input parameter specifies the server:port specification in the same way as the serverport method. If it is omitted, the settings that were created at object creation time or of a previous call to the serverport method, will be assumed. See method stop to stop a server process.

The second input parameter only makes sense if the user is currently "root" (uid == 0). If specifies the name (or uid number) of the user as which the server process should run. If no user is specified, it will continue to run as the user with which this process is running.

stop

 $killed = $daemon->stop;

The "stop" method can be called to stop the server process that is associated with the NexTrieve::Daemon object. It returns a flag indicating whether the attempt was successful or not. See method start to start a server process.

AUTHOR

Elizabeth Mattijsen, <liz@dijkmat.nl>.

Please report bugs to <perlbugs@dijkmat.nl>.

SUPPORT

NexTrieve is no longer being supported.

COPYRIGHT

Copyright (c) 1995-2003 Elizabeth Mattijsen <liz@dijkmat.nl>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

The NexTrieve.pm and the other NexTrieve::xxx modules.