Say you are doing this on / dev / tty 1.
in the shell
chown *youruser* /dev/tty1
and then in a Perl script called example.pl
open PORT, "</dev/tty1" || die "Can't open port: $!"; while (defined ($_ = <PORT>)) { do_something($_); } close PORT;
Obviously, you need to do more if you want it to start automatically, and reborn on error, and so on. But the main idea is to read from the serial port as a file.
source share