in reply to Re^2: Virtual COM port write
in thread Virtual COM port write

That means write() returned undef, which means the write failed entirely. Try checking if $^E contains a useful error message: my $count_out = $PortObj->write($sendData) or die "write failed: $^E";

Try $PortObj->error_msg(1); $PortObj->user_msg(1); right after new() as shown in the module's docs.

Make sure that your handshake really is none, that depends on how the other side of the serial connection is configured.

Replies are listed 'Best First'.
Re^4: Virtual COM port write
by jismake (Initiate) on Apr 20, 2014 at 13:05 UTC
    use Win32::SerialPort; use strict; use warnings; $| = 1; #enable autoflush my $PortName = "COM3"; my $sendData = "12345678"; ### SERIAL PORT SETUP ### my $PortObj = new Win32::SerialPort($PortName) or die "Can't open $Por +tName: $^E\n"; $PortObj->error_msg(1); # prints hardware messages like "Framing Err +or" $PortObj->user_msg(1); # prints function messages like "Waiting fo +r CTS" $PortObj->baudrate(57600); $PortObj->parity("none"); $PortObj->databits(8); $PortObj->stopbits(1); $PortObj->handshake("none"); $PortObj->write_settings or die "failed to write_settings"; my $count_out = $PortObj->write($sendData) or die "write failed: $^E"; sleep(3); $PortObj->close() || warn "\nClose failed\n";
    now i have the following error "write failed:the handle is invalid at test2.pl line 23." Other info : iam using Virtual serial port driver 7.2 by eltima software. i use a tool called teraterm where i can send data on one port and receive on other port without any issues. but perl gives the problem :( thanks for your prompt response. jis
Re^4: Virtual COM port write
by jismake (Initiate) on Apr 22, 2014 at 07:49 UTC

    the issue is resolved. iuninstalled strawberry 64 bit on windows 7 - 64 bit. and installed strawbettry 32 bit on windows 7-64 bit it worked then.. strange! <\p> thanks jis