My guess is, after much googling, that the port is being blocked by the open command/while loop and making it to where I can't use another script to open the same port for write access. There are a number of Event modules in perl for handling event-driven communications, but after reading some posts here, seems like overkill for my simple app

it may seem that way, but you need something to arbitrate between the different processes contending for a given resource; a serial port can only do one thing at a time. While you can try leaving it up to the OS, without any guidance, the OS is most likely going to fall back on something simple/stupid like "first process that gets there monopolizes it until it's done", which is evidently what you're seeing.

My guess is select() is what you want. It may be annoyingly low level, but it was explicitly intended for this kind of situation, it's one of the builtins, thus guaranteed to be there, and it's a fairly old feature (read battle tested).

Or you can grab somebody's event module...


In reply to Re: Best way to read/write to a serial port by wrog
in thread Best way to read/write to a serial port by garlinto

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.