in reply to Access to $self in a thread?
Simply stated, you cannot do what you are trying to do. That is, you cannot share objects between threads.
I'm not going to explain that, but just ask you to take my word for it.
I'm also going to suggest that given your current level of understanding of Perl, you should not even be considering using threads.
An example of what I mean is your new function.
That thread will get a copy of the reference to a scalar, which will be a copy of the scalar $self which will point to a copy of the anonymous hash containing a copy of the key 'universe' and a copy of whatever value was passed in to initialise that value.
Nothing you do to any of the copies, will ever be visible to the other.
%self has no relationship to the scalar called $self.
Given your demonstrated level of understanding of Perl; your attempts to use threading will just fail.
|
|---|