in reply to Re^2: Unusual error in Win32::SerialPort (Missing REQUIRED setting for BAUD)
in thread Unusual error in Win32::SerialPort (Missing REQUIRED setting for BAUD)

Try $Serial->baudrate(0+$baud_rate).

- tye        

  • Comment on Re^3: Unusual error in Win32::SerialPort (Missing REQUIRED setting for BAUD) (guess)
  • Download Code

Replies are listed 'Best First'.
Re^4: Unusual error in Win32::SerialPort (Missing REQUIRED setting for BAUD) (guess)
by Anonymous Monk on Aug 28, 2013 at 18:02 UTC
    Thank you. But it does not work. Nor work similar other tricks like:

    $Serial->baudrate(0+$baud_rate)

    $Serial->baudrate(int($baud_rate))

    $Serial->baudrate("$baud_rate")

    $Serial->baudrate(eval{$baud_rate})

    I don't know what it may be

Re^4: Unusual error in Win32::SerialPort (Missing REQUIRED setting for BAUD) (guess)
by Anonymous Monk on Aug 28, 2013 at 19:34 UTC

    Thank you. But it does not work. Nor work similar other tricks like:

    $Serial->baudrate(int($baud_rate)) $Serial->baudrate("$baud_rate") $Serial->baudrate(eval{$baud_rate})

    The following seems to work (in the sense that it does not produces an error message), but the serial stream does not have the baudrate it is supposed to have

    $Serial->{"_L_BAUD"}{$baud_rate} = $baud_rate; $Serial->baudrate($baud_rate);

    I don't know what it may be

      It was my fault. The code was in a subroutine where $baud_rate was passed by reference and used as if it were passed by value. After correcting the mistake the following construct worked perfectly:
      $Serial->{"_L_BAUD"}{$baud_rate} = $baud_rate; $Serial->baudrate($baud_rate);