SOLVED (sort of) [Fwd: Problem with serial port access in Tk app?]

"John R." <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
I used Google Code search to find other examples of assigning the handle 
to POE::Wheel::ReadWrite.  Code snipped:

     $heap->{fh} = new IO::File;
     if (!$heap->{fh}->open("+</dev/ttyS0")) {
          confess("Unable to open /dev/ttyS0 RW: $!\n");
     }

     set_speed($_[HEAP]->{fh}, '9600');

Then I could do a "Handle => $heap->{fh}"

set_speed I used verbatim and it and the rest seems to work fine:

sub set_speed ($$) {
     my $fh = shift || die;
     my $speed = shift;

     my $termios = POSIX::Termios->new() || die;
     $termios->getattr(fileno($fh)) || die "$!";

     # The handshake is done at 9600
     eval("\$termios->setispeed(&POSIX::B$speed)") || die "$!";
     eval("\$termios->setospeed(&POSIX::B$speed)") || die "$!";

     $termios->setattr(fileno($fh), &POSIX::TCSANOW);
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.