Clear questions and runnable code
get the best and fastest answer
bug in threads::shared or is it just me?by dada (Chaplain)
|on Apr 05, 2012 at 14:35 UTC||Need Help??|
dada has asked for the
wisdom of the Perl Monks concerning the following question:
I observe this strange behaviour with threads::shared (version 1.32, on Ubuntu's Perl 5.12.4 x86_64-linux-gnu-thread-multi):
outside of the sub I get the hash keys, but not the values. like they went out of scope, or something. the output is:
this happens only if I declare the shared hash in a sub and return its content. if I move the hash declaration outside of the sub, everything works:
also if I return a reference to the shared hash, everything works:
the same exact thing happens with arrays too.
is this a bug, or the intended behaviour? and if so, why?
King of Laziness, Wizard of Impatience, Lord of Hubris