in reply to OO and Threads conflict?
Then you can access the shared value as ${$self->{active}}, or as $active{$self} if you're in the package...# note the package level shared hash; this will store the # actual values of the active attribute. my %active : shared; # CONSTRUCTOR sub new { local *IN; my $self = {}; $self->{active} = \$active{$self} = 1; # This vari +able must be shared between threads. $self->{in} = undef; $self->{thread} = undef; open(*IN, "a_program" ) or ${$self->{active}} = 0; $self->{in} = *IN; $self->{thread} = threads->new(\&reader, $self); # Start thread bless($self); return $self; }
At least, I think this will work; it would be nice if I had 5.8.0 installed here to test it :)
--
Mike
|
|---|