Here is my short Perl test script that works without having to open Serial Monitor/PuTTY:
Code:
#!perl -w
use Win32::SerialPort;
use strict;
use warnings;
$| = 1; #enable autoflush
my $PortName = "COM4";
my $sendData = "o";
### SERIAL PORT SETUP ###
my $PortObj = new Win32::SerialPort($PortName) or die "Can't open $PortName: $^E\n";
$PortObj->baudrate(57600);
$PortObj->parity("none");
$PortObj->databits(8);
$PortObj->stopbits(1);
$PortObj->write_settings(); #very important!
$PortObj->write($sendData);
$PortObj->close() || warn "\nClose failed\n";
use Win32::SerialPort;
use strict;
use warnings;
$| = 1; #enable autoflush
my $PortName = "COM4";
my $sendData = "o";
### SERIAL PORT SETUP ###
my $PortObj = new Win32::SerialPort($PortName) or die "Can't open $PortName: $^E\n";
$PortObj->baudrate(57600);
$PortObj->parity("none");
$PortObj->databits(8);
$PortObj->stopbits(1);
$PortObj->write_settings(); #very important!
$PortObj->write($sendData);
$PortObj->close() || warn "\nClose failed\n";
Hopefully this will be of use to someone - maybe me in a few years time when I forget what I did.