I don't know what "minicom" or "centOS5.3" might be, but based on seeing "dev/tty", I gather you have something like a unix or linux system. In that case, you should actually be using "/dev/tty0" or "/dev/stty0" (the initial "/" is important), but I suspect there's more to it than that.

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:

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" 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.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.