Cloning structures containing weak references

M

Mintcake

I've tried various cloning modules to clone a structure containing weak
references.

use Storable 'dclone';
use Scalar::Util qw(weaken isweak);
my $x = 99;
my $y = [ \$x ] ;
weaken $y->[0];
$z = dclone $y;
print "y: ", isweak $y->[0];
print "z: ", isweak $z->[0];

This prints:

y: 1
z:

I've tried it using the Clone module and Clone::pP. Clone::pP does the
same as Storable. Clone gives a segmentation fault.

I'm using Perl 5.8.0 on Linux 2.4.20-8
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top