Device::SerialPort has the advantage that it provides an extra layer of abstraction, and porting to Windows is easier (Win32::SerialPort). However, if you know your application is staying on a *NIX system, then personally my preference is to do away with that extra layer of abstraction and work with a more native API - I wrote about that here: Lower-Level Serial Port Access on *NIX.

I've used both Device::SerialPort and IO::Termios to write serial loggers - the former here, the latter here (which uses this helper module - warning, not yet really production ready), plus a POE-based logger/server here (again, it's just a beta, although so far it seems to have been running well).

Anyway, as for your question, the docs seem to say that ->input is nonblocking, and ->read is AFAIK blocking. (The indeed somewhat lacking documentation is another reason I prefer the lower-level approach, with IO::Select and similar it is more clear to me what is going on.)


In reply to Re: Serial port - "input" vs "read" by haukex
in thread Serial port - "input" vs "read" by fsonnichsen

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.