If you have any sort of command-line tool that knows how to connect to your serial port and read/print the data that comes from the external device, you should be able to open a pipeline file handle in perl, which simply runs this command in a sub-shell, and reads its output in the normal way:
If "minicom" is able to show you the output from the device, and it is a proper command-line utility (as opposed to some sort of interactive tool that requires manual input after it starts), you can just run "minicom" from the perl script and read its output using something like the example above.my $command_line = "prog_name arg1 arg2"; # replace with suitable st +ring open( COM, "-|", $command_line ) or die "can't launch: $command_line"; while (<COM>) { if ( /(\d+)\.\d+ DegF/ and $1 > 80 ) { send_email_alert(); } }
If "minicom" isn't a proper command-line utility, you'll want to figure out how it makes the serial port connection and replicate that with methods available in perl -- try searching CPAN for "serial port".
In reply to Re: parse output from a com device
by graff
in thread parse output from a com device
by zimbot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |