The code that produces the unwanted message is in SerialPort.pm:
# get the current attributes $ok = $self->{TERMIOS}->getattr($self->{FD}); unless ( $ok ) { carp "can't getattr: $!"; undef $self; return undef; }
So either comment out the carp ... line, or (if you don't want to mess with the module's source) overwrite the carp routine that has been imported into the Device::SerialPort namespace. I.e., in your code, before you call the constructor, say
{ no warnings 'redefine'; sub Device::SerialPort::carp { }; # no-op } ... $PortObj = new Device::SerialPort($port, 1) or next;
The latter is somewhat of a dirty hack, because it of course also disables any carp messages that you might actually want to see...
In reply to Re: Supressing error messages on serial port open in Linux
by Eliya
in thread Supressing error messages on serial port open in Linux
by pashanoid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |