Subject: | warning on os/x from ALIAS : Use of uninitialized value in concatenation (.) or string |
Runtime warning that I get, if debug is set, is as follows:
Opening Device::SerialPort /dev/tty.usbserial-A6007XgT
Use of uninitialized value in concatenation (.) or string at
/Library/Perl/5.8.8/darwin-thread-multi-2level/Device/SerialPort.pm line
475, <DATA> line 1.
wrote settings to
(note null 'ALIAS' above)
This warning occurs from SerialPort.pm before the $obj->alias() method
is called. Later in the code, it is called, and it does set the value
correctly. If debug is not enabled then the warning does not occur. It
seems some code is being executed which should not be.
Version info:
This is perl, v5.8.8 built for darwin-thread-multi-2level
(with 4 registered patches, see perl -V for more detail)
/Library/Perl/5.8.8/darwin-thread-multi-2level/Device/SerialPort.pm
Module id = Device::SerialPort
DESCRIPTION POSIX clone of Win32::SerialPort
CPAN_USERID COOK (Kees Cook <cook-cpan@outflux.net>)
CPAN_VERSION 1.04
CPAN_FILE C/CO/COOK/Device-SerialPort-1.04.tar.gz
UPLOAD_DATE 2007-10-24
DSLIP_STATUS RdhOg (released,developer,hybrid,object-oriented,GPL)
MANPAGE Device::SerialPort - Linux/POSIX emulation of
Win32::SerialPort functions.
INST_FILE
/Library/Perl/5.8.8/darwin-thread-multi-2level/Device/SerialPort.pm
INST_VERSION 1.04
My code below.
- $isWin will be false in this case
- warning does not occur if $Debug is false
my $Debug = 1;
my $isWin = 1 if ( $^O eq 'MSWin32' );
my $quiet = 0;
my $lockfile = "lock";
my $serialport;
if ($isWin) {
require Win32::SerialPort;
Win32::SerialPort::debug( "true", "True" ) if ($Debug);
$serialport = new Device::SerialPort ($portname, $quiet, $lockfile)
|| die "Can't open $portname: $!\n";
}
else {
require Device::SerialPort;
Device::SerialPort::debug( "true", "True" ) if ($Debug);
warn "Opening Device::SerialPort $portname\n" if $Debug;
$serialport = new Device::SerialPort ($portname, $quiet, $lockfile)
|| die "Can't open $portname: $!\n";
}