in reply to Using Win32::SerialPort in a module
The warning during global destruction happens because the object destructor for the comm port object tries to clean up by closing the comm port.
The easy way to silence the warning is to close the comm port before global destruction happens, that is, before your program exits:
# in Serial.pm our $port; # in test_Serialpm.pl print "Response num char; ".length($response)."\n"; Serial::port->close();
To make names from Serial.pm available in the program using the Exporter module:
# in Serial.pm use Exporter 'import'; our @EXPORT_OK = (qw(Serial_Init $port)); # in test_Serialpm.pl use Serial 'Serial_Init'; Serial_Init();
|
|---|