Dear All,
I'm taking input from a Serial Port.
#
# open the logfile, and Port
#
open(LOG,">>${LOGDIR}/${LOGFILE}")
||die "can't open smdr file $LOGDIR/$LOGFILE for append: $SUB $!\n";
open(DEV, "<$PORT")
|| die "Cannot open $PORT: $_";
select(LOG), $| = 1; # set nonbufferd mode
#
# Loop forver, logging data to the log file
#
while($_ = <DEV>){
($t,$Extn,$Trunk,$Dialed,$Digits,$Start_time,$Elaspesd_time,$Cost,$Account_Code)
$dbh ->do("INSERT INTO test (TYP,EXTN,DIGITS) VALUES ('$t','$Extn','$DIGITS')");
print LOG "Type = $t | Extn = $Extn | $Trunk | $Dialed | $Digits |$Start_time |$Elapsed_time |$Cost |$Account_Code\n";
}
undef $ob;
My problem is that the variable $t is behaving very odd !
I see the output in the LOG file i.e. print LOG "Type = $t and I can add an additional line to print $t. However if I try and send the value to the MySQL DB. I get the first entry and then all other values of $t are blank ! and yet the value appears in the LOG?
Also if I try and do an if statment on the $t value it works the first time and again it loses its value.
I restart the script and the same...
I'm at loss... any ideas?
Thanks
Shad Mortazavi
I just cant work out why this is?
I'm taking input from a Serial Port.
#
# open the logfile, and Port
#
open(LOG,">>${LOGDIR}/${LOGFILE}")
||die "can't open smdr file $LOGDIR/$LOGFILE for append: $SUB $!\n";
open(DEV, "<$PORT")
|| die "Cannot open $PORT: $_";
select(LOG), $| = 1; # set nonbufferd mode
#
# Loop forver, logging data to the log file
#
while($_ = <DEV>){
($t,$Extn,$Trunk,$Dialed,$Digits,$Start_time,$Elaspesd_time,$Cost,$Account_Code)
$dbh ->do("INSERT INTO test (TYP,EXTN,DIGITS) VALUES ('$t','$Extn','$DIGITS')");
print LOG "Type = $t | Extn = $Extn | $Trunk | $Dialed | $Digits |$Start_time |$Elapsed_time |$Cost |$Account_Code\n";
}
undef $ob;
My problem is that the variable $t is behaving very odd !
I see the output in the LOG file i.e. print LOG "Type = $t and I can add an additional line to print $t. However if I try and send the value to the MySQL DB. I get the first entry and then all other values of $t are blank ! and yet the value appears in the LOG?
Also if I try and do an if statment on the $t value it works the first time and again it loses its value.
I restart the script and the same...
I'm at loss... any ideas?
Thanks
Shad Mortazavi
I just cant work out why this is?