You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Salvador Ortiz Garcia <so...@msg.com.mx> on 2000/09/15 11:25:10 UTC
[BUG REPORT] New Storable hooks broken.
Raphael,
[ Cc: to dev@perl.apache.org because the heavy use of Storable in
mod_perl modules ]
When using the new STORABLE_freeze and STORABLE_thaw hooks noted that
every second instance of a class in an object returned for recursion from
STORABLE_freeze, when retrieving it, cause the message
Class name #1 should have been seen already at...
inside retrieve_idx_blessed (before calling STORABLE_thaw, as espected)
When not using the hooks, all works as documented.
Tested with perl 5.005_03, Storable 0.7.2 and 1.0.0.
I wrote a small test program that shows the problem, please uncomment
the marked line inside Bar::new to see it.
I'm missing something?
Thank you.
Salvador Ortiz.
=== Test program stor.pl ===
#!/usr/bin/perl -w
use Storable();
use Data::Dumper(); # For debug only
package Foo;
sub new {
my $class = shift;
my $dat = shift;
return bless {dat => $dat}, $class;
}
package Bar;
sub new {
my $class = shift;
return bless {
a => 'dummy',
b => [
Foo->new(1),
# Uncomment the following line for a crash
# Foo->new(2), # Second instance of a Foo
]
}, $class;
}
sub STORABLE_freeze {
my($self,$clonning) = @_;
#warn "In freeze...\n";
return "$self->{a}", $self->{b};
}
sub STORABLE_thaw {
my($self,$clonning,$dummy,$o) = @_;
#warn "In Thaw... ('$dummy' eq 'dummy')\n";
$self->{a} = $dummy;
$self->{b} = $o;
}
package main;
my $bar = new Bar;
Storable::nstore($bar, "./bar");
my $bar2 = Storable::retrieve("./bar");
warn Data::Dumper->Dump([$bar,$bar2],['bar','bar2']);
__END__