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).

In reply to Re: Re: Re: Re: OO and Threads conflict? by runrig
in thread OO and Threads conflict? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.