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

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

Marek Rouchal
November 4, 2003 21:25
[perl #24411] perl-5.8.1: threads::shared and objects
Message ID:
# New Ticket Created by  Marek Rouchal 
# Please include the string:  [perl #24411]
# in the subject line of all future correspondence about this issue. 
# <URL: >

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
(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:

use threads;
use threads::shared;
use Data::Dumper;
my $obj = bless { name => 'marek', tel => 25849 }, 'Employee';
print Dumper($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).



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

Jetzt kostenlos anmelden unter

+++ GMX - die erste Adresse f|r Mail, Message, More! +++ Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About