develooper Front page | perl.perl5.porters | Postings from May 2003

threads::shared need to override bless

Thread Next
From:
Arthur Bergman
Date:
May 14, 2003 15:27
Subject:
threads::shared need to override bless
Message ID:
10DB3BA2-865B-11D7-B7C5-000393CB5BC4@contiller.se
Hi,

threads::shared will need to override bless, the problem is that 
currently there is no way to catch a bless on a shared variable, so it 
will be ok in the local copy but not in the shared copy.

This quick example shows what happens.

use strict;
use threads;
use threads::shared;

my $self = bless &share({});
bless $self;
my %bar : shared;
$bar{foo} = $self;
my $foo = $bar{foo};
print "$self - $foo\n";

The, question is, should I override CORE::GLOBAL::bless or should I 
export bless? I suggest exporting my own bless.

Arthur


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About