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);
}

Reply via email to