Why is it a mystery for you that it is working?

Because you are effectively sharing an object between threads which was never designed to work. This is evidenced by the fact that if you try to make $ProcessObj a shared variable so that you could use it directly from other threads, you get an error message along the lines of:

Invalid value for shared scalar at ...

You've bypassed this design restriction by stringifying the object handle Win32::Process=SCALAR(0x3e820f0) into a shared variable and then string evaling it back into existence in the other thread:$ProcessObj = eval($ProcessObj_as_string).

The problem you had is that this only worked once. What my 'fix' does is avoid it being done multiple times. But the fact that it is not repeatable, means that it works by chance, rather than by design. Indeed, the design was to explicitly prevent it.

In fact the only reason it does work once for this particular object is because the object is a simple blessed scalar reference that contains a process-wide OS handle--which is just a number.

If the object contained any perlish state--that is, any perl instance variables--it wouldn't work.

Basically, you got something to work through sheer luck, but you shouldn't rely upon it for anything remotely serious.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^3: Suspend/Resume a process from Tk GUI in Windows XP by BrowserUk
in thread Suspend/Resume a process from Tk GUI in Windows XP by Dirk80

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.