On 6/30/05, demerphq <[EMAIL PROTECTED]> wrote:
> Incidentally this is a pretty common mistake when handling REF's.
> Data::Dumper does it as does YAML and pretty much all the other
> storage tools that i have looked at, although Storable gets it right.
> Also, i should say that while this circular ref stuff does look
> bizarre it really is just a simple example of a general class of
> datastructure that many dumpers get wrong.

A similar problem is the following. (Similar in that solving one
should solve the other, assuming is_deeply does a parallel traverse of
the two structures.)

use Test::More tests=>2;
use Data::Dump::Streamer;

sub alias_ar { [EMAIL PROTECTED] }

my ($x,$y,$z)=(2,2,2);

is_deeply(alias_ar($x,$x), alias_ar($y,$z), "Alias");
is(scalar Dump(alias_ar($x,$x))->Out,scalar
Dump(alias_ar($y,$z))->Out,'Alias using DDS');

__END__
1..2
ok 1 - Alias
not ok 2 - Alias using DDS
#     Failed test (d:\dev\Stuff\is_deeply.pl at line 10)
#          got: '$ARRAY1 = [
#             2,
#             'A: $ARRAY1->[0]'
#           ];
# alias_av(@$ARRAY1, 1, $ARRAY1->[0]);
# '
#     expected: '$ARRAY1 = [
#             ( 2 ) x 2
#           ];
# '
# Looks like you failed 1 test of 2.



-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Reply via email to