Dear monks,

After a couple of days of dire difficulties, I finally managed to marry Win32::SerialPort, Tk and threads into a jolly threesome. It was an interesting experience and I plan to write a largish article about it, but for now I'd like to ask about two problems I still have with Win32::SerialPort:

  1. When I try to read and open a port which already receives a stream of data, sometimes I get errors opening and sometimes the data is weird. All is fine when the port is idle when I open it.
  2. I wrap calls to SerialPort's functions with eval{}, but yet some errors "slip through". In a GUI environment this is intolerable. Any ideas ?

By the way, I use SerialPort to monitor several ports simultaneously. My "paradigm" for doing it is:

my ($done, $rb, $byte) = $port->read_done(0); $port->read_bg(1) if ($done); if ($rb > 0) { print $fh "$byte\n"; }
This is because I need to record any character individually (I actually log the time of its arrival).

In reply to problem with SerialPort on multiple ports by spurperl

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.