It looks like I'll have need to write code that accesses data from either an RS-232 serial port or a USB port (I'm not sure which, yet). At minimum, I'll need to do so on both FreeBSD and Debian GNU/Linux (FreeBSD first as the development platform), so a certain amount of portability across OSes is important.

The purpose of the code will be for sensor testing -- in the sense of gathering sensor output, then filtering and organizing to provide some kind of useful information to the computer user. As such, what I basically need is some way to access the serial or USB port and grab data in some kind of textual form that I can operate on with regexen, et cetera. I imagine there's a Perl module for this out there somewhere (isn't there one for everything else, including doing dishes and making coffee?), but everything I've found so far seems to be either specific to a device type, for using a fake serial port to test code, or specific to MS Windows. Maybe I'm just searching incorrectly.

Anyway . . . suggestions for the best module or techniques to use would be much appreciated, especially with some explanation for why it's the best (even if that explanation is "It's the only way I know how!").

print substr("Just another Perl hacker", 0, -2);
- apotheon
CopyWrite Chad Perrin


In reply to basic serial and USB access by apotheon

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.