Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: mysterious threads::shared behaviour

by gone2015 (Deacon)
on Jan 18, 2009 at 11:45 UTC ( #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
Node Status?
node history
Node Type: note [id://737137]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2019-11-12 11:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (65 votes). Check out past polls.

    Notices?