new

Usage     : new()
Purpose   : invokes the server
Returns   : object reference
Comment   : creates the server object including shared memory creation.
          

NAME

Device::Velleman::K8055::Server - IPCS Server for the K8055 Device

SYNOPSIS

use Device::Velleman::K8055::Server;

my $server = Device::Velleman::K8055::Server->new();

DESCRIPTION

Sets up a server that handles all communication with the K8055 device. Communicates with clients through shared memory.

USAGE

Example of a daemon that initiates the server:

use Device::Velleman::K8055::Server;
use Proc::Daemon;
use Tie::Hash;

$SIG{HUP} = 'shutdown';


foreach my $argnum (0 .. $#ARGV) {

	if( $ARGV[$argnum] eq '--debug' ) {
		$debug=1;
	}
	if( $ARGV[$argnum] eq '--nodaemon' ) {
		$nodaemon=1;
	}
	
	if( $ARGV[$argnum] eq '--server' ) {
		$server=1;
	}
	
}


if($server) {
	print "Running Server\n";
	server();
}


sub server {
	#Run as Daemon unless -nodaemon passed.
	unless( $nodaemon ) {
		print "Running as daemon.\n";
		Proc::Daemon::Init;
	}
	my $server = K8055::Server->new();
	$server->run;
}



sub shutdown {
	$server->cleanup();
	exit;
}

BUGS

Many.

SUPPORT

AUTHOR

David Peters
CPAN ID: DAVIDP
davidp@electronf.com
http://www.electronf.com

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

Device::Velleman::K8055::Client, Device::Velleman::libk8055, perl(1).