Problems? Is your data what you think it is? | |
PerlMonks |
Re: Sharing Package variables across threadsby ikegami (Patriarch) |
on Aug 31, 2011 at 20:26 UTC ( [id://923510]=note: print w/replies, xml ) | Need Help?? |
threads::shared has no effect on variables, package or otherwise. The question is really whether you can make a shared package variable. share doesn't say it only works on lexical variables. Let's try it to confirm:
So yes, you can. Sharing adds magic to a variable, and thread cloning handles variables with this magic specially. It doesn't care whether the variable is accessible via the symbol table (package variable), via a function's pad (lexical variable), both or neither.
In Section
Seekers of Perl Wisdom
|
|