in reply to Threads::Shared MultiLevel Hash and the Invalid value for Shared Scalar Error

What do you think that unless (exists $$dataref{$sid}{"ALL"}){ is testing?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.
  • Comment on Re: Threads::Shared MultiLevel Hash and the Invalid value for Shared Scalar Error
  • Download Code

Replies are listed 'Best First'.
Re^2: Threads::Shared MultiLevel Hash and the Invalid value for Shared Scalar Error
by DFass (Initiate) on Feb 10, 2014 at 21:57 UTC

    It SHOULD be testing the next level of the %data hash, passed by reference.

    It OUGHT to be already Shared, but, since I know that there is the auto-vivication trap in the module...thus, the test.

    The hash has 3 sub-hashes: ID (the year-month), COUNTY (either ALL, OOC, or a County name, and the VARIABLE...

    So e.g. it'd be $$dataref{"2013-1"}{"ALL"}{"MatchesStarted"}

      Wow. I did some work on this a month ago, but I doubt I still have the file in which I did it. I assumed you weren't coming back and probably ditched it. I sure don't relish recreating what I did :(

      But, since you've now answered the first question, try this one.

      What do you mean by "It fails on the :unless (exists $$dataref{$sid}{"ALL"}){ line."?

      Issues a warning? Dies with an error? Crashes with a core dump? Get bored and goes home?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      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.

        Sorry..got really swamped at doing other things at work, plus, had several days of snow delays

        It gives me "Thread X terminated abnormally: Invalid value for shared scalar at S:\Reports\NotWorking\Stats5c.pl line 594, <DATA> line 335"

        <\p>

        It's probably a warning -- in that it doesn't outrightly die on me.

        Which of course means the hash population which this is supposed to be changing is unpopulated when it returns...

        In my 'fiddling' with Threads::Shared, I wongled together a means of doing a single variable and field combo

        E.G. $$dataref{$variable}{"FieldName"}++;

        which seemed to work...

        I may have to, while not ideal, split the %data hash into 2 or 3 hashes -- one part for the shared pieces (using a split-able string single level hash) and one for the unshared portions. And presumably use split to re-merge the shared portions back.