Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Error: Invalid value for shared scalar when assigning a scalar

by ISAI student (Scribe)
on Apr 23, 2013 at 16:02 UTC ( #1030180=perlquestion: print w/ replies, xml ) Need Help??
ISAI student has asked for the wisdom of the Perl Monks concerning the following question:

Hello all. I am getting from these two lines of code (numbers 1244 & 1245):

print( "\$wave_tcl_file is $wave_tcl_file\n"); ${$$all_shary_for_subs{'%sim_info'}{$sim_ref}}{'tcl_file'} = $wave_tcl +_file
And I am getting this output:

$wave_tcl_file is /scratch/ldagan/edata/eng/ldagan/voodoo_from_1.1.7.b4/Results/Log/0000___tc_dataif_simple.wave.tcl

Invalid value for shared scalar at /edata/eng/ldagan/voodoo_from_1.1.7.b4/DesignLibs/ScriptLib/Generic/WMPerl/voodoo//voodooBuild.pm line 1245.

Isn't $wave_tcl_file a scalar ? 1 line before it looked like a normal string...

Comment on Error: Invalid value for shared scalar when assigning a scalar
Select or Download Code
Re: Error: Invalid value for shared scalar when assigning a scalar
by kennethk (Monsignor) on Apr 23, 2013 at 16:26 UTC
    I expect that the problem is not $wave_tcl_file, but rather is $all_shary_for_subs. I assume you are using threads::shared and $all_shary_for_subs is declared with :shared. As the docs say,
    Shared variables can only store scalars, refs of shared variables, or refs of shared data

    Without seeing more information around your block, I would guess you are trying to store an anonymous hash in your shared variable.


    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      Thanks. There was a typo in the code. The toplevel hash was not shared.
Re: Error: Invalid value for shared scalar when assigning a scalar
by BrowserUk (Pope) on Apr 23, 2013 at 17:03 UTC

    You cannot autovivify multi-level hash elements in shared hashes. They must be created & shared explicitly.


    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1030180]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2014-12-25 16:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls