SPUG: serial I/O from Perl (W32 & Red Hat)

Michael R. Wolf MichaelRWolf at att.net
Tue Apr 27 19:36:56 CDT 2004

I'm connecting two systems together for the purpose of testing.

It's been a long time since I twiddled bits across a serial port. Last
time I did so it was in assembly and C. I'd like to do much better
this time -- Perl.

Other than the following useless answer in FAQ8, any pointers to info
 write a serial port on W32
 read a serial port on W32
 write a serial port on Unix (Red Hat 7.2)
 read a serial port on Unix (Red Hat 7.2)

On the Unix box.
    $from_w32 = unix_read();
    $to_w32 = unix_read($byte);

And on the W32 box, same thing...
    $from_unix = w32_read();
    $to_unix = w32_read($byte);

I've seen a reference to Win32::SerialPort and Win32API::CommPort.
Which of this the best one to start studying?

What's the naming convention for a serial port (/dev/someting?) in Red

Could it really be that serial port I/O is so thinly documented? To
paraphrase RTFM, I've read the fine manuals and found them lacking.
Perhaps it's me, and there's better documentation that I haven't

Michael Wolf


    How do I read and write the serial port?

    This depends on which operating system your program is running on.
    In the case of Unix, the serial ports will be accessible through
    files in /dev; on other systems, device names will doubtless
    differ. Several problem areas common to all device interaction are
    the following: lockfiles

    Your system may use lockfiles to control multiple access. Make
    sure you follow the correct protocol. Unpredictable behavior can
    result from multiple processes reading from one device.

Michael R. Wolf
    All mammals learn by playing!
        MichaelRWolf at att.net

More information about the spug-list mailing list