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

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

Replies are listed 'Best First'.
Re^5: Unusual error in Win32::SerialPort (Missing REQUIRED setting for BAUD) (guess)
by Anonymous Monk on Aug 29, 2013 at 18:32 UTC
    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);