On Wed, 10 Jul 2019 08:51:08 -0500 "Martin McCormick" <marti...@suddenlink.net> wrote: > The code below talks to what it thinks is a RS-232 serial > port and controlls a radio scanner so that one can program the > scanner's settings and enter frequency and operational data. > Don't worry about all that. It used to work on debian stretch > which is last year's version of debian. After an upgrade to > buster which is this year's version, also known as debian 10, all > RS-232 ports appear to be dead. [...] > The very same code ported to the buster system also fails with > Can't call method "baudrate" on an undefined value > at /home/martin/etc/mm line 121.
OK, so it failed to get the Device::SerialPort object; there's no error-checking in your code where you instantiate it, so it explodes on the next line when you try to call a method on it: > our $port = Device::SerialPort->new("$dev"); > $port->baudrate(115200); Adding some error checking could help - e.g.: my $port = Device::SerialPort->new($dev) or die "Failed to open serial port $dev - $!"; I'd guess that $! may contain an error explaining what happened - and the constructors section of Device::SerialPort's doco supports that. Try modifying your code as mentioned above, and see what error you get. (And, while you're modifying, Shlomi's helpful review of your code contained loads of useful advice too - but you might want to focus on just resolving the actual problem first I guess). I'd also, without having seen anything else, take a gut feeling guess in the dark that Buster has changed the permissions applied to serial port device nodes, possibly via AppArmor and that the user you run your code as no longer has access to open the port - but that *is* just a guess - you'll know if it's right if your modified code reports a permissions error as it dies. If so, you could look at the device node permissions to see the user and group it's owned by, e.g.: [davidp@supernova:~]$ ls -l /dev/ttyS0 crw-rw---- 1 root dialout 4, 64 Jul 8 09:28 /dev/ttyS0 ... change to suit which device you're trying to use, and make sure your user is a member of the group specified. Cheers Dave P (BIGPRESH) -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/