Hi all,

In my quest to get NSTextView to display japanese text using CB I decided to try to get it to read from a named pipe, so that I could use the readRTFDFromFile () method. Unfortunately, it doesn't work. I don't really know why, or how to debug it, but the code is something like:

sub nextCard {
my ($self) = @_;
my $fifo = "/tmp/fifo.$$";

unless (-p $fifo) {
unlink $fifo;
system("mkfifo $fifo")
&& die "can't mknod $fifo: $!";
}
unless (my $pid = fork) { # if child
open (FIFO, ">$fifo") || die "can't write $fifo: $!";
open (CARDS, "$ENV{HOME}/cards.rtf") or die "can't read cards file.";
print FIFO $_ while (<CARDS>);
close CARDS;
close FIFO;
exit;
}
$self->{'CardText'}->readRTFDFromFile ($fifo);
unlink $fifo;
return 1;
}

Now, if I insert a sleep in there I can manually cat the named pipe in /tmp, no problem. I get the expected rtf spewage. I can also have the NSTextView read from $HOME/cards.rtf directly--no problems. But as it is, it displays nothing, nor does it give me any errors.

So I guess NSText and friends are not happy reading from a named pipe, for whatever reason. My next step will be to make temporary rtf files at run time.

-Dan

Reply via email to