Forum Moderators: coopster & phranque

Message Too Old, No Replies

How to control serial port with Perl?

         

leunga

1:22 pm on Sep 11, 2005 (gmt 0)

10+ Year Member



I have a message display board which has a serial control function. Any one has experience on sending and receiving data via serial port with Perl?

I did a search on CPAN with the keyword "serial port", but the returned results has 2801 entries. If I think I need a generic module, which is the right choice?

Thank you for advice.

SeanW

6:24 pm on Sep 11, 2005 (gmt 0)

10+ Year Member



Unix, or DOS?

Sean

leunga

11:35 pm on Sep 11, 2005 (gmt 0)

10+ Year Member



I am using DOS, but also interested to know what is the difference in Unix.

moltar

12:29 am on Sep 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've used Device::Modem [search.cpan.org] to communicate with my cellphone via serial com port.

my $modem = new Device::Modem( port => 'COM1' );

It works on Win32 and Linux systems, because it's built on top of 2 other modules Device::SerialPort for Linux and Win32::SerialPort for Win32 machines.

SeanW

2:03 am on Sep 12, 2005 (gmt 0)

10+ Year Member



For Unix I've just open()ed the device (/dev/ttyS1), I think there's a good example in the Camel book.

For Windows, the Win32::SerialPort that moltar mentioned seems familiar. His cross platform one seems the way to go, though.

Sean