in reply to Re: Declaring/Assigning thread shared vars
in thread Declaring/Assigning thread shared vars

If the limitation is on shared()'s prototype, you can get perl to ignore it by calling it as &shared( ... )

Replies are listed 'Best First'.
Re^3: Declaring/Assigning thread shared vars
by BrowserUk (Patriarch) on Nov 18, 2004 at 03:07 UTC

    It's a good point, and a good thought, but it doesn't help (much) unfortunately.

    Whilst disabling the prototype allows me to pass an anonymous hash directly to share(), it still causes any contents in that hash to be discarded.

    It does mean that you can share and assign an empty anonymous hash directly into the parent shared hash, which avoids the temp var at the slight inconvenience of obscurity, but it still doesn't make up for the lack autovivification :(


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon