Telnet module or stop processing

Telnet module or stop processing

am 08.11.2004 16:22:56 von f8arr

Hello

Before everything, i'll explain the aim of my program:

I Admin an Ham radio server that give to ham radio throw an Telnet protocol
informations about who is on frequencies and where.
The aim of this server is to increase chance to contact countrys of island
or any other things...

Once connected, informations arrive on console depending submission of ham
radio themselves (when we hear a good station we put it on the server and
others users see it).
Actually we have hamradio in Bhutan (Himmalaya) and i would like to contact
them . But they are on frequencies just one our per day.
I'm unable to look all the time the server with informations scrolling
because i'm at work.
I had an idear to make a "robot" taht connect with my profile, put me on
status not here...(working fine) and parsing datas fo callsign of my freinds
in bhutan.
When Callsign is recognized, i'll send email (not made yet on my script)

So i made a script in perl throw module Telnet 3.03 that connect to server
with my callsign and password and parse datas with waitfor module object.
For this i de-activate the timeout in order to parse during long time (as
long as i didn't saw the callsign).
As this script will work in background, i would like to be able to STOP it.
So i made a file (/tmp/dxalert.tmp) on wich there is a value (1 for running)
and (0 for stopping)

I would like to verify this value in order to stop the running script.
My problem is that when i initialize an "waitfor" object looking for
callsign i'm unable to look in /tmp/dxalert.tmp.

Which method could i use to verify my tmp file ?
perhaps my method is not good one ?

here is my script, the parsing tmp file is not working... other is ok.
every idear is welcome.



############################################################ ####
#
# We open temp file
#
open(TMP,">/tmp/$TEMPFILE.tmp")|| die ("unable to open /tmp/$TEMPFILE.tmp")
;
$VAL=;

if ($VAL == "0")
{
# We parameter Telnet object
use Net::Telnet ();
$t = new Net::Telnet (Timeout => undef,
Port => $PORT);
# We connect
$t->open("$SERVER");

## Wait for first prompt and fill in.
$t->waitfor('/Callsign :.*$/');
$t->print("$CALL");

## Wait for password prompt and respond .
$t->waitfor('/Password :.*$/');
$t->print("$PASSWORD");

## We put the user in "no present" (not here status)
($cluster) = $t->waitfor('/.*=>/');
$t->print("set\/noh");

## We are waiting for DX
while ($VAL != "1"){
($DXWANTED)= $t->waitfor("/.*$WANTED/");
$VAL=;
}
#Send email (not done yet)
}
else
{
print "error\n";
}
close TMP;

############################################################ #####
thanks for you'r help.


Guillaume, f8arr