Subject: | weak references aren't preserved when frozen |
Any frozen weak references will become regular references when thawed.
------------
Version:
------------
Storable: 2.12
perl: 5.6.1 for debian linux and 5.8.2 for solaris
------------
Test case:
------------
use strict;
use Storable qw(freeze thaw);
use Scalar::Util qw(weaken isweak);
use Test::More tests => 3;
# make a circular reference, then weaken it
my $a={};
$a->{a}=\$a;
weaken($a->{a});
# looks like we're ok
ok(isweak($a->{a}),"weak reference created");
# serilize it
my $b=freeze($a);
# and unpack it
my $c=thaw($b);
# check if the weak reference survived the freeze
ok($c->{a},"reference came back out");
ok(isweak($c->{a}),"weak references preserved");