in reply to Re: Re: OO and Threads conflict?
in thread OO and Threads conflict?

Gee... Thanks. =)

When referring to them as ${$self->{var}] it DOES work. The problem is now officially solved. Now, would you please explain to me what you did, because I am feeling abit lost here. =)

And... This doesn't mean that the data is shared between all instances off the class, right?

Replies are listed 'Best First'.
Re: Re: Re: Re: OO and Threads conflict?
by runrig (Abbot) on Sep 21, 2002 at 01:32 UTC
    This doesn't mean that the data is shared between all instances off the class, right?

    That I couldn't tell you for sure. My guess is that the data IS shared in a way across all threads, but since the reader is only looking at the one instance passed to it, that should be the only data that matters between those two threads, and another instance will generate a separate shared variable in a separate object and so the reader for that object will be looking at different data.

    BTW, $hash{key} = \$var stores a reference to the scalar in the hash, and normally to dereference a scalar reference you put a '$' in front of it, but since its in a hash you need to wrap the whole thing with curlies. E.g.

    my $var = 1; my $ref = \$var; my %hash = ( key => \$var ); # All print '1' print $var; print $$ref; print ${$hash{key}};
    You could probably look through perlref and perlreftut and other reference tutorials...search this site..(sorry don't have any handy).