Hi Monks, I tried to ask in the Chatterbox, but I run out of charakters. I hope that it is allowed to ask here for help instead. I'm new to Perl and programming and english :-P (sorry for that). Im trying to read/write Serial Data and show them with Tk. I am using threads (one for read and one for write (because Non-blocking reading was impossible for me without threads)). I learned that threads have to be created before Tk starts. My Problem is the following: I want to be able to change/start the COM-Port from Tk.
my $PortObj = new Control::CLI (Use => $PortName);
but then I have to transfer the new $PortObj to the already running worker-threads. How would you do that? If I do in this order: $PortObj > workers > Tk-gui -> everything works fine. But $PortObj > workers > Tk-gui > "change PortObject and give new one to the worker-threads" fails. I tried many different things (please remember I am newbie) for example:
giving $PortObj by :shared var, to workers
giving $PortObj by queue, to workers
giving $PortObj by queue "freeze $PortObj" using Storable to workers
that all failed. My scripts normally get to work by
until ($everything_works){ try; error; read the Manual; google; }
but this time I think I need an advice. Thank you in advance!!! Best regards Stefan.

In reply to Tk and threads and Control::CLI- change Port-(Object) in Tk an let workers know by notworx

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.