This works well:
my $PortObj;
$PortObj = new Win32::SerialPort ("COM12") || die "Can't open COM\n";
However when I try to provide a variable instead of "COM12" from TK Entry, like this:
my $portNumVar = "12";
my $portNum = $mw->Entry(-justify=>'center',-width=>'5',-textvariable=>\$portNumVar)->pack();
Inside a subroutine (after a button click):
my $PortObj;
my $com = "COM".$portNumVar;
print $com;
$PortObj = new Win32::SerialPort ($com) || die "Can't open COM\n";
I get this error:
Win32::API::Call: parameter 1 had a buffer overflow at C:/Perlx86_5.16/site/lib/Win32API/CommPort.pm line 176.
How is it even possible? Shouldn't it be the same?
Thanks, Mark.