package GlxModd; use strict; use warnings; use GlxGlobalVars; use GlxInetServer; use GlxShMem; sub new { my $class = shift; my $id = shift; my $device = shift; my $port = shift; my $logfile = shift; my $debug = shift || 0; my $string = shift || ''; my $self = bless { ID => GlxShMem->alloc($id), DEVICE => GlxShMem->alloc($device), PORT => GlxShMem->alloc($port), LOGFILE => GlxShMem->alloc($logfile), DEBUG => GlxShMem->alloc($debug), STRING => GlxShMem->alloc($string), STAT => GlxShMem->alloc(0), # MODEM => GlxShMem->alloc(0), # GSM => GlxShMem->alloc(0), } => $class; $self->{STAT}->put(0); return $self; } sub status { my $self=shift; return $self->{STAT}->get; } sub main { my $self = shift; my $server = GlxInetServer->new($self->{PORT}->get, $self->{DEBUG}->get, $self->{STRING}->get); for ( ; $server->accept() ; $server->close()) { my $in = $server->read(); SWITCH: { ($in =~ /^something/) && do { $server->write("OK"); # FAKE my $z=0; while (1) { $self->{STAT}->put(1); $z++; $server->write($z); sleep 1; last if ($z==20); } $self->{STAT}->put(0); }; }; } } # main 1;