Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: mysterious threads::shared behaviour

by gone2015 (Deacon)
on Jan 18, 2009 at 11:45 UTC ( [id://737137]=note: print w/replies, xml ) Need Help??


in reply to mysterious threads::shared behaviour

Update: spoke too soon, sorry -- I'd left out the use threads.

With use threads in I get the same as you. I notice the caveat in cpan:/threads::shared re refaddr() -- I guess that applies to stringification too. So, it seems to be a documented problem. is_shared() is recommended in place of refaddr, but I don't know how that helps you with XML::Dumper -- sorry.

FWIW: I just tried your code and got 11 different addresses -- I have perl 5.10.0 with threads::shared version 1.14 (32 bit Win32) and 1.27 (64 bit Linux).

In the past I have found shared() to be less than useful. You could try:

for (0..10) { my %sh : shared ; $h{$_}=\%sh ; }
and see if it works any better for you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://737137]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-24 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found