[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SpeechIO-11] may have found the cause of the dropped lines




speech.irc writes to the STDIN of the perl program catspeech.  This is
catspeech:

----------------------------------------------------------------------
#!/usr/bin/perl

#  Kyle R. Burton
#  http://www.voicenet.com/~mortis
#  mortis@voicenet.com
#
# Requirements:
#  * speechd -
#    http://www.op.net/~darxus/speech
#  * Perl (duh)
#
#  Available at http://www.op.net/~darxus/speech

$fifo = "/dev/speech";

while( <STDIN> ) {
  open FIFO, ">$fifo" or die "Error opening $fifo for writing  $!\n";
  print FIFO $_;
  close FIFO;
}
----------------------------------------------------------------------


I believe the problem may be the way it's opened.  

  open FIFO, ">$fifo"
              ^
(what is that comma?)

But I think that should be like:

  open FIFO, ">>$fifo"

Basically, every time catspeech re-opened /dev/speech (which is every time
it has a new line to write to it), it was over-writing/erasing anything
that was still in /dev/speech.  But was stuff still in there ?  I think..
but probably only if $/ was not undef'ed, which it currently isn't.


BTW, based on my beliefs of what should be possible w/ I/O to/from
/dev/speech, I just got speechd to work w/out opening & closing
/dev/speech continuously (one open at the beginning).  Now I'm trying to
do the same in catspeech.  

__________________________________________________________________
PGP fingerprint = 03 5B 9B A0 16 33 91 2F  A5 77 BC EE 43 71 98 D4
            darxus@op.net / http://www.op.net/~darxus
                         Far Beyond Reason