Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2022-05-20 10:12 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (73 votes). Check out past polls.