in reply to using win32::serialport

From Win32::SerialPort:

Version 0.15 adds an optional $quiet parameter to new. Failure to open a port prints a error message to STDOUT by default. Since only one application at a time can "own" the port, one source of failure was "port in use". There was previously no way to check this without getting a "fail message".(italics added by starbolin) Setting $quiet disables this built-in message. It also returns 0 instead of undef if the port is unavailable (still FALSE, used for testing this condition - other faults may still return undef). Use of $quiet only applies to new.

This would imply something like:

{ $|++;print "\rPort Busy ",$i++;sleep 1; die "Can't wait any longer\n" if ($i>=15); } while (($portObj = new Win32::SerialPort ($PortName, $quiet))==0); die "Other reason for not working: $!\n" if ($portObj==undef);
I don't think $^E will have any information in either case as the port is not setup yet only the control block is being created and even that has failed, but that's an untested assumption.

If you haven't already, you should fully explore the resources on Bill's page

Good luck


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

Replies are listed 'Best First'.
Re^2: using win32::serialport
by Anonymous Monk on Apr 13, 2005 at 17:11 UTC
    many thanks for the responses...helps to understand these com ports better.