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

[perl #24411] perl-5.8.1: threads::shared and objects

From:
Marek Rouchal
Date:
November 4, 2003 21:25
Subject:
[perl #24411] perl-5.8.1: threads::shared and objects
Message ID:
rt-24411-67045.1.54065572689056@rt.perl.org
# New Ticket Created by  Marek Rouchal 
# Please include the string:  [perl #24411]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24411 >


I have a perl-5.8.1 with ithreads and shared libperl, compiled with
gcc-3.1.1 on
Solaris/Sparc 7. Debugging some test problems with Class::PObject and
Test::Builder
(latest CPAN versions), I stumbled across this problem:

$ /opt/perl_5.8.1/bin/perl -d -e 1
  DB<1> use threads
  DB<2> use threads::shared
  DB<3> $obj = bless { name => 'marek', tel => 25849 }, 'Employee'
  DB<4> x $obj
0  Employee=HASH(0x83fa5a4)
   'name' => 'marek'
   'tel' => 25849
  DB<5> share($obj)
  DB<6> x $obj
0  Employee=HASH(0x83fa5a4)
     empty hash

Or as a script:

#!/opt/perl_5.8.1/bin/perl
use threads;
use threads::shared;
use Data::Dumper;
my $obj = bless { name => 'marek', tel => 25849 }, 'Employee';
print Dumper($obj);
share($obj);
print Dumper($obj);

The second dump is an object of the same class, but
all keys/values are gone.

I don't think this is the intended behaviour, or at least
the documentation of threads::shared is not clear to me;
I read the "BUGS" section carefully, but I don't think that
explains this problem.

I see the same thing in my perl-5.8.0 (ithreads).

Cheers,

Marek

-- 
NEU F\R ALLE - GMX MediaCenter - f|r Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gru_, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse f|r Mail, Message, More! +++





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