in reply to send command to RS232, then get data from RS232

This is a bug in the Device::SerialPort package. The Device::SerialPort package will internally new a POSIX termios object, and store the object in $self->{TERMIOS}. In your case, that new failed, thus $self->{TERMIOS} is undef.

But later when it call $self->{TERMIOS}->setcflag, it didn't first check whether $self->{TERMIOS} is defined.

I suggest you report this bug, and you should suggest the author to make more strict checkings in his package.
  • Comment on Re: send command to RS232, then get data from RS232