PDA

View Full Version : Can't call method "databits" on an undefined value?


haluong
08-06-2008, 07:17 AM
Dear all,

I have the error when I try to use Win32::SerialPort as follow:
"Can't call method "databits" on an undefined value"

My code as follow:
$win32SerialPort = Win32::SerialPort-> new ($portName);
# Initialize parameters
$win32SerialPort->databits(8);

Could you please help me?

Thanks
Ha

KevinADC
08-06-2008, 07:57 AM
this line is not creating the $win32SerialPort object:

$win32SerialPort = Win32::SerialPort-> new ($portName);

is $portName defined?

Check the Win32::SerialPort module for any debugging/error options.

haluong
08-08-2008, 05:29 AM
this line is not creating the $win32SerialPort object:

$win32SerialPort = Win32::SerialPort-> new ($portName);

is $portName defined?

Check the Win32::SerialPort module for any debugging/error options.

Hi Kevin,
I use $portName = "COM1". It is happen when I connected COM1 by HyperTerminal. If I close Hyper, it is ok.

KevinADC
08-08-2008, 07:38 AM
OK. If you need further help I have no idea what to suggest.