Hi there:
I have written a number of small test and demo Perl scripts that
communicate with devices via serial ports (RS-232 and RS-485). I usually
work under Linux, but unfortunately, most recipients have Microsoft Windows.
Serial ports are still quite popular. For example, in my spare time, I
tinker with an Arduino Due board:
https://github.com/rdiez/JtagDue
This kind of boards tend to provide virtual serial ports over USB.
Again, many Arduino users run Windows.
I have written my Perl scripts so that they work on both Linux and
Windows. On Linux, they load module Device::SerialPort, and on Windows,
Win32::SerialPort.
However, the Windows side is a pain. First of all, the users have to
type some CPAN command after installing Perl, which is a small barrier
for many computer laymen.
Furthermore, module Win32::SerialPort does not work on 64-bit Windows.
That is not a big problem, as I can tell users to download the 32-bit
Perl version. It is just another detail to keep in mind.
More importantly, that module often fails to install because many PCs
do not have a serial port named COM1, so the self-tests up installation
fail. This is often true for laptops with "USB to serial" converters, if
the user has not plugged the USB converted before installing the module.
This is actually a long-standing issue:
https://rt.cpan.org/Public/Bug/Display.html?id=89837
The Win32::SerialPort module maintainer has stated that he does not
consider it as a bug. So far he has not fixed the issue. I have known
this problem for many years.
It is all very frustrating. I often hear the typical "forget Perl, just
switch to Python".
There is one thing that would resolve this issue though: if
Win32::SerialPort were bundled with Strawberry Perl, serial ports will
work straight away, at least with the 32-bit version.
Regards,
rdiez