in reply to use Devel::Pointer in threads

For the why:

> Can someone help to explain how this happen?

Perl's model for threading is to clone the interpreter with the data. It's allowing thread-safety by emulating forking.

The shared data is explicitly tunneled between the threads.

New data - including their refs - doesn't exist in other threads unless they are shared.

Hence using a backdoor like Devel::Pointer to the memory address can't work.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: use Devel::Pointer in threads
by exilepanda (Friar) on Apr 05, 2021 at 01:08 UTC
    Thanks but this didn't explain why Data::Dumper can actually fetch what's inside, but I can't when explicitly write to print $Deep->{B}. Also, how a hash can have same key exists when Dump.