in reply to Re^2: forked::shared with hashes?
in thread forked::shared with hashes?

No, for me, it worked with a hash as well. The restriction applies to threads::shared, not forks::shared.

Replies are listed 'Best First'.
Re^4: forked::shared with hashes?
by BrowserUk (Patriarch) on Apr 02, 2011 at 12:31 UTC
    The restriction applies to threads::shared,

    Could you:

    1. explain "the restriction"
    2. either show where that restriction is documented; or code to demonstrate it?

    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.
      I just cited "the restriction" from the previous post. I thought the author might mean this:
      In the standard Perl threads implementation, arrays and hashes are re-initialized when they become shared (with the share()) function. The share() function of forks::shared does not initialize arrays and hashes when they become shared with the share() function.
      Quoted from the documentation of forks::shared.
        I thought the author might mean this: ...

        Okay. I'm not sure that matches the OPs description: It turns out the problem has to do with the restriction that you should share scalar variables, not complex structures like hashes., but given that he is obviously very confused, and still not using strict, understandable :)

        You also said; "No, for me, it worked with a hash as well.". Does that work bidirectionally? Ie. Can the parent see changes made to the hash by the child?


        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.