DCPM: dumping cyclic structures

Steve Marvell steve at fysh.org
Wed Nov 27 10:01:26 CST 2002


Dumping cyclic structures is great, until you want to eval them, it
seems. 

Any ideas?

Cheers

Steve

#!/usr/bin/perl

use Data::Dumper;

$old = { name => "bob" };
$young = { name => "bob jr" };

$old->{child} = $young;
$young->{parent} = $old;

$string = Data::Dumper->Dump([$old],[qw(old)]);

undef $old;
undef $young;

eval $string;

$check = Data::Dumper->Dump([$old],[qw(old)]);

if ($string ne $check) {

  print "eek!\n---\n$string---\n$check";
}




More information about the Devoncornwall-pm mailing list