NAME

DTA::CAB::Server - abstract class for DTA::CAB servers

SYNOPSIS

 use DTA::CAB::Server;
 
 ##========================================================================
 ## Constructors etc.
 
 $srv = CLASS_OR_OBJ->new(%args);
 undef = $srv->initialize();
 
 ##========================================================================
 ## Methods: Generic Server API
 
 $rc = $srv->prepare();
 $rc = $srv->run();
 $rc = $srv->finish();
 
 ##-- low-level methods
 $rc = $srv->prepareSignalHandlers();
 $rc = $srv->prepareLocal(@args_to_prepare);
 

DESCRIPTION

Globals

Variable: @ISA

DTA::CAB::Server inherits from DTA::CAB::Persistent and DTA::CAB::Logger.

Constructors etc.

new
 $srv = CLASS_OR_OBJ->new(%args);

%args, %$srv:

 ##-- supported analyzers
 as => \%analyzers,     ##-- ($name => $cab_analyzer_obj, ...)
 aos => \%anlOptions,   ##-- ($name=>\%analyzeOptions, ...) : passed to $as{$name}->analyzeXYZ($xyz,%analyzeOptions)
 ##
 ##-- daemon mode support
 pidfile => $pidfile,   ##-- write PID to file on prepare()
 pid     => $pid,       ##-- PID to write to $pidfile (default=$$)
initialize
 undef = $srv->initialize();

Called to initialize new objects after new()

Methods: Generic Server API

prepare
 $rc = $srv->prepare();

Prepare server $srv to run. Default implementation initializes logger, writes $pidfile (if defined), and pre-loads each analyzer in values(%{$srv->{as}}) by calling that analyzers prepare() method.

prepareSignalHandlers
 $rc = $srv->prepareSignalHandlers();

Initialize signal handlers. Default implementation handles SIGHUP, SIGTERM, SIGKILL, and __DIE__.

prepareLocal
 $rc = $srv->prepareLocal(@args_to_prepare);

Dummy method for subclass-local initialization, called by "prepare"() after default "prepare"() guts have run.

run
 $rc = $srv->run();

Run the server. No default implementation.

finish
 $rc = $srv->finish();

Cleanup method; should be called when server dies or after "run"() has completed. Default implementation unlinks $pidfile (if defined).

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009-2019 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or, at your option, any later version of Perl 5 you may have available.