Subject: | Core dump when unblessing a blessed and tied hashref. |
Tie a hash to 'Tie::IxHash'.
Bless the hashref to a package.
Call Data::Structure::Util::unbless for the blessed hashref.
Perl core dumps.
If I do the same using the Acme::Damn damn function instead, then it
works as expected.
See the attached script that demonstrates the bug.
My Perl version is 5.8.8 amd64.
Subject: | t.pl |
# $Id$
use strict;
use Acme::Damn qw(damn);
use Data::Structure::Util ();
use Data::Dumper qw(Dumper);
use Tie::IxHash;
{
package BlessedHashRef;
sub new {
my $proto = shift;
my $hashref = shift;
my $class = ref($proto) || $proto;
my $self = $hashref;
bless($self, $class);
return $self;
}
}
my %args;
tie(%args, 'Tie::IxHash');
%args = (
'foo' => 'bar',
'bla' => 'bleh',
'perl' => 'script',
'empty' => undef,
);
my $blessed = BlessedHashRef->new(\%args);
print Dumper($blessed);
print "About to damn using Acme::Damn\n";
my $damned = Acme::Damn::damn($blessed);
print Dumper($damned);
print "About to unbless using Data::Structure::Util\n";
$damned = Data::Structure::Util::unbless($blessed);
print Dumper($damned);